-
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
Add closeButtonLabel to flyout #1031
Conversation
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.
LGTM, thanks for adding! I just had one main comment about the name of the prop.
src/components/flyout/flyout.js
Outdated
/** | ||
* Specify an aria-label for the close button of the flyout. | ||
*/ | ||
closeButtonLabel: 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.
Can you rename this to closeButtonAriaLabel
so that it's absolutely clear by the prop name itself what the "label" is?
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.
The other option is to start a closeButtonProps
object to handle more than just the aria-label.
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 went with closeButtonAriaLabel
, since I think if we allow overwriting everything on the button, consumers might be able to mess around too much with the close button as it is.
src/components/flyout/flyout.js
Outdated
@@ -98,10 +107,15 @@ EuiFlyout.propTypes = { | |||
* Locks the mouse / keyboard focus to within the flyout | |||
*/ | |||
ownFocus: PropTypes.bool, | |||
/** | |||
* Specify an aria-label for the close button of the flyout. |
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.
No period necessary here
src/components/flyout/flyout.test.js
Outdated
expect(label).toBe('Closes this dialog'); | ||
}); | ||
|
||
test('has a default label for the close button', () => { |
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.
Should this test read as 'has a custom label for close button'?
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.
Of course... copy-paste-error :D
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.
LGTM, code review
Give the
FlyOut
component a property to overwrite thearia-label
of the close button, so consumers can make this more specific to their flyout (e.g. relabeling it to: "Close Inspector").