-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover] Fix sidebar element focus behavior when adding / removing columns #75749
Changes from 8 commits
0ac5b98
2a091d3
2ef14f6
3b118c6
12acf3a
7994764
88b6e76
4f26d30
8fe749e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,5 @@ export function createDiscoverSidebarDirective(reactDirective: any) { | |
['onRemoveField', { watchDepth: 'reference' }], | ||
['selectedIndexPattern', { watchDepth: 'reference' }], | ||
['setIndexPattern', { watchDepth: 'reference' }], | ||
['state', { watchDepth: 'reference' }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR also contains a few cleanups of unused state variable |
||
]); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,16 @@ export function FieldButton({ | |
|
||
return ( | ||
<div className={classes} {...rest}> | ||
<button onClick={onClick} {...buttonProps} className={buttonClasses}> | ||
<button | ||
onClick={(e) => { | ||
if (e.type === 'click') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious, if it is ever something else than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it could also be triggered by an enter key, but in this case it should already have focus |
||
e.currentTarget.focus(); | ||
} | ||
onClick(); | ||
}} | ||
kertal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{...buttonProps} | ||
className={buttonClasses} | ||
> | ||
{fieldIcon && <span className="kbnFieldButton__fieldIcon">{fieldIcon}</span>} | ||
{fieldName && <span className="kbnFieldButton__name">{fieldName}</span>} | ||
{fieldInfoIcon && <div className="kbnFieldButton__infoIcon">{fieldInfoIcon}</div>} | ||
|
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.
@andreadelrio this should prevent Chrome from setting focus to the last focused sidebar element in case of a click
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.
Tested this and it seems to solve the issue properly.