Skip to content

Commit

Permalink
rename feature flag, update JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Jan 17, 2025
1 parent 6bc5144 commit 48f3d25
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
17 changes: 9 additions & 8 deletions packages/button/src/vaadin-button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ import { ButtonMixin } from './vaadin-button-mixin.js';
*/
declare class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {
/**
* When set to true, prevents any user interaction with the button
* such as clicking, focusing, etc.
* When set to true, prevents any user interaction with the button such as
* clicking, hovering, etc. It also removes the button from the tab order.
*
* To improve accessibility, disabled buttons can be made focusable
* so that screen readers can reach and properly announce them to
* users. Other interactions such as clicks remain disabled. This
* behavior is currently experimental and can be enabled with the
* feature flag:
* Please note that this behavior may negatively impact accessibility, as disabled
* buttons become completely hidden from screen readers. To improve accessibility,
* disabled buttons can be made focusable so that screen readers can reach and
* properly announce them, including any attached tooltips and popovers, while
* still preventing clicks. This is currently available as an experimental feature
* that can be enabled with the following feature flag:
*
* ```
* // Set before any button is attached to the DOM.
* window.Vaadin.featureFlags.focusableDisabledComponents = true
* window.Vaadin.featureFlags.accessibleDisabledButtons = true;
* ```
*/
disabled: boolean;
Expand Down
19 changes: 10 additions & 9 deletions packages/button/src/vaadin-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,19 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
static get properties() {
return {
/**
* When set to true, prevents any user interaction with the button
* such as clicking, focusing, etc.
* When set to true, prevents any user interaction with the button such as
* clicking, hovering, etc. It also removes the button from the tab order.
*
* To improve accessibility, disabled buttons can be made focusable
* so that screen readers can reach and properly announce them to
* users. Other interactions such as clicks remain disabled. This
* behavior is currently experimental and can be enabled with the
* feature flag:
* Please note that this behavior may negatively impact accessibility, as disabled
* buttons become completely hidden from screen readers. To improve accessibility,
* disabled buttons can be made focusable so that screen readers can reach and
* properly announce them, including any attached tooltips and popovers, while
* still preventing clicks. This is currently available as an experimental feature
* that can be enabled with the following feature flag:
*
* ```
* // Set before any button is attached to the DOM.
* window.Vaadin.featureFlags.focusableDisabledComponents = true
* window.Vaadin.featureFlags.accessibleDisabledButtons = true;
* ```
*/
disabled: {
Expand Down Expand Up @@ -92,7 +93,7 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly

/** @override */
_shouldAllowFocusWhenDisabled() {
return window.Vaadin.featureFlags.focusableDisabledComponents;
return window.Vaadin.featureFlags.accessibleDisabledButtons;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/button/src/vaadin-lit-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElem

/** @override */
_shouldAllowFocusWhenDisabled() {
return window.Vaadin.featureFlags.focusableDisabledComponents;
return window.Vaadin.featureFlags.accessibleDisabledButtons;
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/button/test/button.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ describe('vaadin-button', () => {
});
});

describe('disabled and focusable', () => {
describe('disabled and accessible', () => {
let lastGlobalFocusable: HTMLInputElement;

before(() => {
window.Vaadin.featureFlags ??= {};
window.Vaadin.featureFlags.focusableDisabledComponents = true;
window.Vaadin.featureFlags.accessibleDisabledButtons = true;
});

after(() => {
window.Vaadin.featureFlags!.focusableDisabledComponents = false;
window.Vaadin.featureFlags!.accessibleDisabledButtons = false;
});

beforeEach(async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/component-tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ before(() => {
});
});

describe('focusable disabled button', () => {
describe('accessible disabled button', () => {
let button, tooltip;

before(() => {
window.Vaadin.featureFlags ??= {};
window.Vaadin.featureFlags.focusableDisabledComponents = true;
window.Vaadin.featureFlags.accessibleDisabledButtons = true;
});

after(() => {
window.Vaadin.featureFlags.focusableDisabledComponents = false;
window.Vaadin.featureFlags.accessibleDisabledButtons = false;
});

beforeEach(() => {
Expand Down

0 comments on commit 48f3d25

Please sign in to comment.