Skip to content

Commit

Permalink
Ensure palette layer buttons container is not focusable in electron
Browse files Browse the repository at this point in the history
When experimental web platform features are enabled, the blink
KeyboardFocusableScrollers feature is enabled.
This causes scrollable container to become keyboard-focusable.
See: https://bugs.chromium.org/p/chromium/issues/detail?id=907284

Even trickier, setting tabindex to -1 on a web component causes
everything inside of it to become untabbable.
See: WICG/webcomponents#774

So the solution in this case is to wrap up the action-group component
with a plain old div with tabIndex -1, and let that div handle the
overflow/scrolling instead.
  • Loading branch information
Cirras committed May 7, 2022
1 parent c3d53cb commit 0744ed8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/components/palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,15 @@ export class Palette extends LitElement {
>
<sp-icon slot="icon">${ChevronLeftIcon()}</sp-icon">
</sp-action-button>
<eomap-action-group
<div
tabindex="-1"
id="layer-buttons"
compact
@scroll=${this.onLayerButtonsScroll}
>
${this.renderLayerButtons()}
</eomap-action-group>
<eomap-action-group compact>
${this.renderLayerButtons()}
</eomap-action-group>
</div>
<sp-action-button
class="scroll-arrow"
quiet
Expand Down

0 comments on commit 0744ed8

Please sign in to comment.