diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index 1336a395dce..5b9cd4a7a6b 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -5,6 +5,7 @@ import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTa import { startFocusVisible } from '@utils/focus-visible'; import { getElementRoot, raf, renderHiddenInput } from '@utils/helpers'; import { printIonError, printIonWarning } from '@utils/logging'; +import { FOCUS_TRAP_DISABLE_CLASS } from '@utils/overlays'; import { isRTL } from '@utils/rtl'; import { createColorClasses } from '@utils/theme'; import { caretDownSharp, caretUpSharp, chevronBack, chevronDown, chevronForward } from 'ionicons/icons'; @@ -1606,7 +1607,7 @@ export class Datetime implements ComponentInterface { forcePresentation === 'time-date' ? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)] : [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)]; - return {renderArray}; + return {renderArray}; } private renderDatePickerColumns(forcePresentation: string) { diff --git a/core/src/components/picker-column-option/picker-column-option.scss b/core/src/components/picker-column-option/picker-column-option.scss index 6e1533aaf7c..4f109981ea5 100644 --- a/core/src/components/picker-column-option/picker-column-option.scss +++ b/core/src/components/picker-column-option/picker-column-option.scss @@ -3,7 +3,7 @@ // Picker Column // -------------------------------------------------- -button { +.picker-column-option-button { @include padding(0); @include margin(0); @@ -40,6 +40,6 @@ button { opacity: 0.4; } -:host(.option-disabled) button { +:host(.option-disabled) .picker-column-option-button { cursor: default; } diff --git a/core/src/components/picker-column-option/picker-column-option.tsx b/core/src/components/picker-column-option/picker-column-option.tsx index 0afcad24db3..774295d4e75 100644 --- a/core/src/components/picker-column-option/picker-column-option.tsx +++ b/core/src/components/picker-column-option/picker-column-option.tsx @@ -129,9 +129,9 @@ export class PickerColumnOption implements ComponentInterface { ['option-disabled']: disabled, })} > - + ); } diff --git a/core/src/components/picker-column-option/test/picker-column-option.spec.ts b/core/src/components/picker-column-option/test/picker-column-option.spec.ts index 2f33a3359a4..e60f60522df 100644 --- a/core/src/components/picker-column-option/test/picker-column-option.spec.ts +++ b/core/src/components/picker-column-option/test/picker-column-option.spec.ts @@ -3,7 +3,7 @@ import { newSpecPage } from '@stencil/core/testing'; import { PickerColumnOption } from '../picker-column-option'; describe('picker column option', () => { - it('button should be enabled by default', async () => { + it('should be enabled by default', async () => { const page = await newSpecPage({ components: [PickerColumnOption], html: ` @@ -12,12 +12,11 @@ describe('picker column option', () => { }); const option = page.body.querySelector('ion-picker-column-option')!; - const button = option.shadowRoot!.querySelector('button')!; - await expect(button.hasAttribute('disabled')).toEqual(false); + await expect(option.classList.contains('option-disabled')).toEqual(false); }); - it('button should be disabled if specified', async () => { + it('should be disabled if specified', async () => { const page = await newSpecPage({ components: [PickerColumnOption], html: ` @@ -26,8 +25,7 @@ describe('picker column option', () => { }); const option = page.body.querySelector('ion-picker-column-option')!; - const button = option.shadowRoot!.querySelector('button')!; - await expect(button.hasAttribute('disabled')).toEqual(true); + await expect(option.classList.contains('option-disabled')).toEqual(true); }); }); diff --git a/core/src/components/picker-column/picker-column.tsx b/core/src/components/picker-column/picker-column.tsx index bea5f11e9fc..6eb4241eac7 100644 --- a/core/src/components/picker-column/picker-column.tsx +++ b/core/src/components/picker-column/picker-column.tsx @@ -654,39 +654,6 @@ export class PickerColumn implements ComponentInterface { return el ? el.getAttribute('aria-label') ?? el.innerText : ''; }; - /** - * Render an element that overlays the column. This element is for assistive - * tech to allow users to navigate the column up/down. This element should receive - * focus as it listens for synthesized keyboard events as required by the - * slider role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role - */ - private renderAssistiveFocusable = () => { - const { activeItem } = this; - const valueText = this.getOptionValueText(activeItem); - - /** - * When using the picker, the valuetext provides important context that valuenow - * does not. Additionally, using non-zero valuemin/valuemax values can cause - * WebKit to incorrectly announce numeric valuetext values (such as a year - * like "2024") as percentages: https://bugs.webkit.org/show_bug.cgi?id=273126 - */ - return ( -
(this.assistiveFocusable = el)} - class="assistive-focusable" - role="slider" - tabindex={this.disabled ? undefined : 0} - aria-label={this.ariaLabel} - aria-valuemin={0} - aria-valuemax={0} - aria-valuenow={0} - aria-valuetext={valueText} - aria-orientation="vertical" - onKeyDown={(ev) => this.onKeyDown(ev)} - >
- ); - }; - render() { const { color, disabled, isActive, numericInput } = this; const theme = getIonTheme(this); @@ -700,33 +667,21 @@ export class PickerColumn implements ComponentInterface { ['picker-column-disabled']: disabled, })} > - {this.renderAssistiveFocusable()}