-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Controls] [PresentationUtil] QoL improvements to control creation form #162067
[Controls] [PresentationUtil] QoL improvements to control creation form #162067
Conversation
DataViewPicker
and FieldTypeFilter
ae3d46c
to
78c3a6f
Compare
8fdff2d
to
476a6be
Compare
In my attempt at implementing the fix from elastic/eui#6627 (comment), I found a bug where the Therefore, this is blocked until elastic/eui#6955 is merged and available in Kibana 👍 Edit: Blocked on #162209 |
Unblocked now that #162209 is merged. |
ebc5266
to
332e87d
Compare
8467c96
to
f3af677
Compare
15997e1
to
fb5508d
Compare
fb5508d
to
bb9c0c4
Compare
@@ -259,7 +259,7 @@ export const ControlEditor = ({ | |||
<EuiFormRow | |||
label={ControlGroupStrings.manageControl.displaySettings.getWidthInputTitle()} | |||
> | |||
<> | |||
<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.
Switched this to a div
so that it can receive the id
passed down from the EuiFormRow
component - not sure why, but the React fragment ignored it 🤷
@@ -50,7 +54,7 @@ export const FieldPicker = ({ | |||
.filter((f) => typesFilter.length === 0 || typesFilter.includes(f.type as string)) | |||
.filter((f) => (filterPredicate ? filterPredicate(f) : true)), | |||
['name'] | |||
), | |||
).sort((f) => (f.name === initialSelection.current ? -1 : 1)), |
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 brings the selected field, if provided, to the top of the list on load.
focusTrapProps={{ | ||
returnFocus: false, // we will be manually returning the focus to the search | ||
onDeactivation: setFocusToSearch, | ||
}} |
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 is the important change in this file - it ensures that, as described in elastic/eui#6627 (comment), the focus returns to the search field when the field type filter is closed (either via Esc
or through the natural tab order).
Pinging @elastic/kibana-presentation (Team:Presentation) |
…wter/kibana into fix-controls-form-props_2023-07-14
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.
Ran this locally and looked through the code. Presentation team changes LGTM!
One small a11y / design question though:
I noticed that having the focus on the search
input and using the arrow keys is the only way to select a field via the keyboard. If I have focus on the filter by type
button I cannot use the arrow keys.
This seems strange to me? Is it at all possible to make the arrow keys work correctly when either element is focused?
If not, I wonder if we should swap their positions so that the filter by type button comes first? This might link the search input more obviously with the field selector. @andreadelrio do you have any thoughts on this?
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @Heenawter |
Unfortunately, to my understanding, it's not - this is what @cee-chen had to say about it (from this issue that I raised with the EUI team):
With respect to,
I am definitely interested to see what @andreadelrio thinks :) |
@Heenawter @ThomThomson I wonder if joining them like in Discover would solve this issue? As an added bonus, I think it would look better and we'd be re-using a existing pattern. |
That's a great call! |
Visually I agree it looks nice, but I'm not sure EuiSelectable yet supports a custom
It would not solve the keyboard UX/a11y issue that Devon mentioned above. Here is the issue: the main search input needs to trigger several important keyboard shortcuts - pressing enter/space to select and up/down arrows to navigate through selections being the major ones. That is the defining standard of a W3 combobox spec. However, EUI cannot easily extrapolate those keyboard shortcuts to any other custom nodes being rendered. We simply have no idea what their intention is and whether they want that behavior. In this instance for example, you want the enter/space key to toggle a popover, not toggle a selection. Why should the arrow keys behave differently? And if you did want it to behave differently, how would EUI be able to pass our keyboard event behaviors to you? |
Looks like That being said, as @cee-chen suspected, it suffers from the exact same keyboard UX/a11y issues that @ThomThomson brought up.
That is definitely fair - even in our specific case, assuming we got the following to work:
What, then, is the behaviour when hitting the enter key? When the search box has the focus, pressing the enter key selects an item - but, if the field type filter button is in focus, what should happen? Should the popover be opened, or should a field be selected? It gets.... weird 😆 With all this in mind, I feel like we're still left with two options if we stick with
|
Nice! I love it when our components are more flexible than I remember 😆
Yep, this is the exact conundrum :) Personally, my 2c is that it's not an accessibility issue, and it's not a huge UX friction point and is probably fine as-is. When on the search input, EUI includes clear screen reader instructions as to how to interact with the component (arrow keys to navigate and enter key to select). If a custom interactive/focusable component is included within the EuiSelectable, it doesn't inherit those instructions, and therefore the keyboard shortcuts aren't expected - so at the very least, the behavior isn't confusing to screen reader users. And for non-SR users, the |
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.
Design changes LGTM. Nice improvements @Heenawter !
Closes #162697
Summary
This PR adds a few tiny UI improvements to the control creation elements, including...
Data view picker:
Made the
Data view
form title respond to focus as expectedSwitched to use
EuiInputPopover
rather thanEuiPopover
Removed the redundant popover title
Field picker:
Made the
Field
form row title respond to focus as expected for all of the inner form elementsSwitched the
FieldTypeFilter
to useEuiInputPopover
rather thanEuiPopover
Removed the redundant title from the
FieldTypeFilter
popoverMade changes described in (Accessibility) [EuiSelectable] Unable to make selections when second interactable element in focus eui#6627 (comment) so that, when the field type filter is closed (either via
Esc
or through the natural tab order), the focus returns to the search fieldIf provided, the initial selected field is now brought to the top of the list
Controls display settings:
Surrounded the
Minimum width
row with adiv
so that it can receive theid
passed down from theEuiFormRow
and respond to focus as expectedChecklist
For maintainers