-
Notifications
You must be signed in to change notification settings - Fork 843
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 focus state regression of icons in EuiFormControlLayout. #898
Fix focus state regression of icons in EuiFormControlLayout. #898
Conversation
473dc12
to
51a8acb
Compare
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.
@cchaos Ready for your 👀 again! |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
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.
iconType
vs type
?
onClick, | ||
...rest | ||
}) => { | ||
const classes = classNames('euiFormControlLayoutIcons__clearButton', className); |
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 would think this className should be euiFormControlLayoutClearButton
to keep with our conventions.
{...rest} | ||
> | ||
<EuiIcon | ||
className="euiFormControlLayoutIcons__clearButtonIcon" |
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.
This one would need to change too.
right: $euiFormControlPadding; | ||
} | ||
|
||
.euiFormControlLayoutIcons__clearButton { |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
Missing ;
|
||
const { | ||
ref: iconRef, | ||
side, // eslint-disable-line no-unused-vars |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
LG, tested in IE too. Just one class omission.
{...rest} | ||
> | ||
<EuiIcon | ||
aria-hidden="true" |
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.
You'd want the same className here as well.
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.
Maybe even just create a variable for the EuiIcon
node
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.