Skip to content

Commit c1574ff

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

1 file changed

Lines changed: 9 additions & 44 deletions

File tree

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

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

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

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

0 commit comments

Comments
 (0)