-
Notifications
You must be signed in to change notification settings - Fork 88
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 keyboard support to the new SettingsPanel
design
#684
base: feature/improve-click-handling-on-touch-devices
Are you sure you want to change the base?
Add keyboard support to the new SettingsPanel
design
#684
Conversation
* handles keyboard interactivity implementation for SettingsPanels
…ingsPanelSelectOption
* disables bubbling up to parent elements if they are also focusable
@if $inset == false { | ||
box-shadow: $focus-element-box-shadow; | ||
} @else { | ||
box-shadow: inset $focus-element-box-shadow; |
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 box shadow has to be inset for settings panel items as otherwise it is not visible (they are at the edge of the settings panel and it has the overflow hidden)
@@ -129,6 +129,10 @@ export class Container<Config extends ContainerConfig> extends Component<Config> | |||
'aria-label': i18n.performLocalization(this.config.ariaLabel), | |||
}, this); | |||
|
|||
if (typeof this.config.tabIndex === 'number') { |
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 ComponentConfig
already has the tabIndex property but it's not consistently applied when creating the dom elements.
buttonElement.on('focusin focusout', (e) => { | ||
e.stopPropagation(); | ||
}); |
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 needed to stop bubbling of the focusin
event to parents. This is a problem in the new settings panel where the subtitle settings button is inside a focusable settings panel item. Without that the focusin
fires on both elements which is undesired.
…eature/add-keyboard-support-to-the-new-settings-panel
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.
As discussed in slack, it would be a nice to have to be able to navigate the settings panel with the arrow keys (up/down selects the row and left/right goes into/out of sub menus).
But that might be a feature for another day.
Description
The new
SettingsPanel
design doesn't support keyboard interactions yet. In the old layout this was handled by the browser as we usedSelectBox
es. Since we switched to a custom element in the new layout we need to add the keyboard support manually.This PR introduces a new
InteractiveSubtitleSettingsPanelItem
, adding key listeners that trigger the existing click event. The new type is used as super type for theDynamicSettingsPanelItem
and theSettingsPanelSelectOption
.