-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix possibly mis-measured text width in DatePicker #320
Conversation
private yearArrowRefHandler = (r: HTMLElement) => this.yearArrow = r; | ||
private containerRefHandler = (r: HTMLElement) => this.containerElement = r; | ||
private monthArrowRefHandler = (r: HTMLElement) => this.monthArrowElement = r; | ||
private yearArrowRefHandler = (r: HTMLElement) => this.yearArrowElement = r; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated: I would like to move to the following pattern for ref handlers:
private refHandlers = {
container: (r: HTMLElement) => this.containerElement = r,
monthArrow: ...,
yearArrow: ...,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm accumulating a list of major refactors to datetime code, for the new year...
will add this!
private yearArrow: HTMLElement; | ||
private containerElement: HTMLElement; | ||
private monthArrowElement: HTMLElement; | ||
private yearArrowElement: HTMLElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 great renames
This looks great. Thank you. I also like the refHandler pattern you're using. I was doing the gross
PS You guys above Hill Country? |
@paulpooch yes the what's this Hill Country? |
Hill Country was in reference to one of your NYC offices. |
* Add containerElement to measureTextWidth function signature * Create a ref handler for the container element, and pass the element in
Fixes #316
Changes proposed in this pull request:
containerElement
parameter toUtils.measureTextWidth
(defaults todocument.body
)DatePicker
to ensure we're measuring text as sized within that componentReviewers should focus on:
*Element
suffixes to each of the elements for clarity and consistency. The type handles that, but this makes things easier to read quickly at a glance.100px
and observing that the<DatePicker>
dropdown arrows still appeared in the expected place.