Fix focus state regression of icons in EuiFormControlLayout.#898
Conversation
473dc12 to
51a8acb
Compare
|
@cchaos Ready for your 👀 again! |
cchaos
left a comment
There was a problem hiding this comment.
I was able to follow this much better. I just had some comments/concerns mainly about classes.
| ...rest | ||
| }) => { | ||
| const classes = classNames( | ||
| 'euiFormControlLayoutIcons__customIcon', |
There was a problem hiding this comment.
I would think this className should be euiFormControlLayoutCustomIcon to keep with our conventions.
| return ( | ||
| <EuiIcon | ||
| aria-hidden="true" | ||
| className={classes} |
There was a problem hiding this comment.
Hmmm, my worry here is that the classes are added directly to the SVG here, but are added to the button if there's a click. It seems we could have misleading/incorrect styles because they're completely different elements with the same classes. Can we maybe just change the outer element to be span or button?
| EuiFormControlLayoutCustomIcon.propTypes = { | ||
| className: PropTypes.string, | ||
| onClick: PropTypes.func, | ||
| type: PropTypes.string, |
| onClick, | ||
| ...rest | ||
| }) => { | ||
| const classes = classNames('euiFormControlLayoutIcons__clearButton', className); |
There was a problem hiding this comment.
I would think this className should be euiFormControlLayoutClearButton to keep with our conventions.
| {...rest} | ||
| > | ||
| <EuiIcon | ||
| className="euiFormControlLayoutIcons__clearButtonIcon" |
There was a problem hiding this comment.
This one would need to change too.
| right: $euiFormControlPadding; | ||
| } | ||
|
|
||
| .euiFormControlLayoutIcons__clearButton { |
There was a problem hiding this comment.
I would split these into their own files as we do other components.
|
|
||
| return ( | ||
| <EuiFormControlLayoutClearButton | ||
| aria-label="Clear selections" |
There was a problem hiding this comment.
Label is too specific here, maybe just "Clear" or "Clear input". "Selections" (plural) won't make sense if we use this for single selection elements.
| ref: iconRef, | ||
| side, // eslint-disable-line no-unused-vars | ||
| ...iconRest | ||
| } = iconProps |
|
|
||
| const { | ||
| ref: iconRef, | ||
| side, // eslint-disable-line no-unused-vars |
There was a problem hiding this comment.
I think these two is where I get confused, but I think it's just my lack of knowledge. But are you creating these or supplying these? And if you're creating the iconRef, how does one access it?
| width: $euiSize; | ||
| @include size($euiSize); | ||
|
|
||
| .euiIcon { |
There was a problem hiding this comment.
Now that it's broken down further, I think we can go ahead and give the EuiIcon a custom class for this.
|
Thanks for the review @cchaos. I've addressed your feedback, could you take another look? |
6d6e4f8 to
d3a21c4
Compare
cchaos
left a comment
There was a problem hiding this comment.
LG, tested in IE too. Just one class omission.
| {...rest} | ||
| > | ||
| <EuiIcon | ||
| aria-hidden="true" |
There was a problem hiding this comment.
You'd want the same className here as well.
There was a problem hiding this comment.
Maybe even just create a variable for the EuiIcon node
There was a problem hiding this comment.
It looks like it adjusts the position of the icon specifically when it's inside a button, so I don't think it's needed here. Am I missing something?
There was a problem hiding this comment.
Oh yeah... I guess I was thinking long-term in case we or a consumer needed to target that icon specifically, it would be nice to have a class. Meaning, they would actually be the same class .euiFormControlLayoutCustomIcon__icon that would only have specific styles (for now) within .euiFormControlLayoutCustomIcon--clickable
There was a problem hiding this comment.
Oh I see. I think I'll punt on this for now since I don't think we have a compelling need for it yet, and it will be simple to add once we do.
d3a21c4 to
998e419
Compare
…lastic#898)" This reverts commit b78e76d. # Conflicts: # CHANGELOG.md # src/components/form/file_picker/_file_picker.scss # src/components/form/form_control_layout/_mixins.scss
…Layout. (elastic#898)"" This reverts commit 7d645ee.
Fixes #893
Thanks for catching this @cchaos!
I tested the following scenarios:
I also added a note to the CHANGELOG under 0.0.50 noting this regression.