Skip to content

Commit ddc90e2

Browse files
committed
fix(picker-column): adapt structure to prevent double tab tap on keyboard navigation
1 parent 7c424d7 commit ddc90e2

File tree

1 file changed

+9
-44
lines changed

1 file changed

+9
-44
lines changed

core/src/components/picker-column/picker-column.tsx

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -653,38 +653,6 @@ export class PickerColumn implements ComponentInterface {
653653
return el ? el.getAttribute('aria-label') ?? el.innerText : '';
654654
};
655655

656-
/**
657-
* Render an element that overlays the column. This element is for assistive
658-
* tech to allow users to navigate the column up/down. This element should receive
659-
* focus as it listens for synthesized keyboard events as required by the
660-
* slider role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role
661-
*/
662-
private renderAssistiveFocusable = () => {
663-
const { activeItem } = this;
664-
const valueText = this.getOptionValueText(activeItem);
665-
666-
/**
667-
* When using the picker, the valuetext provides important context that valuenow
668-
* does not. Additionally, using non-zero valuemin/valuemax values can cause
669-
* WebKit to incorrectly announce numeric valuetext values (such as a year
670-
* like "2024") as percentages: https://bugs.webkit.org/show_bug.cgi?id=273126
671-
*/
672-
return (
673-
<div
674-
ref={(el) => (this.assistiveFocusable = el)}
675-
class="assistive-focusable"
676-
role="slider"
677-
tabindex={this.disabled ? undefined : 0}
678-
aria-label={this.ariaLabel}
679-
aria-valuemin={0}
680-
aria-valuemax={0}
681-
aria-valuenow={0}
682-
aria-valuetext={valueText}
683-
aria-orientation="vertical"
684-
onKeyDown={(ev) => this.onKeyDown(ev)}
685-
></div>
686-
);
687-
};
688656

689657
render() {
690658
const { color, disabled, isActive, numericInput } = this;
@@ -699,24 +667,21 @@ export class PickerColumn implements ComponentInterface {
699667
['picker-column-disabled']: disabled,
700668
})}
701669
>
702-
{this.renderAssistiveFocusable()}
703670
<slot name="prefix"></slot>
704671
<div
705672
class="picker-opts"
706673
ref={(el) => {
707674
this.scrollEl = el;
708675
}}
709-
/**
710-
* When an element has an overlay scroll style and
711-
* a fixed height, Firefox will focus the scrollable
712-
* container if the content exceeds the container's
713-
* dimensions.
714-
*
715-
* This causes keyboard navigation to focus to this
716-
* element instead of going to the next element in
717-
* the tab order.
718-
*/
719-
tabIndex={0}
676+
role="slider"
677+
tabindex={this.disabled ? undefined : 0}
678+
aria-label={this.ariaLabel}
679+
aria-valuemin={0}
680+
aria-valuemax={0}
681+
aria-valuenow={0}
682+
aria-valuetext={this.getOptionValueText(this.activeItem)}
683+
aria-orientation="vertical"
684+
onKeyDown={(ev) => this.onKeyDown(ev)}
720685
>
721686
<div class="picker-item-empty" aria-hidden="true">
722687
&nbsp;

0 commit comments

Comments
 (0)