Skip to content

Commit

Permalink
fix(dialog): ensure :focus-visible polyfill availability
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Jan 21, 2021
1 parent 4eaf6a2 commit b50e396
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 11 additions & 6 deletions packages/dialog/src/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import crossStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.c
import '@spectrum-web-components/icon/sp-icon.js';
import { Cross500Icon } from '@spectrum-web-components/icons-ui';
import { AlertIcon } from '@spectrum-web-components/icons-workflow';
import { ObserveSlotPresence } from '@spectrum-web-components/shared';
import {
ObserveSlotPresence,
FocusVisiblePolyfillMixin,
} from '@spectrum-web-components/shared';

import styles from './dialog.css.js';

Expand All @@ -37,11 +40,13 @@ import styles from './dialog.css.js';
*
* @fires close - Announces that the dialog has been closed.
*/
export class Dialog extends ObserveSlotPresence(SpectrumElement, [
'[slot="hero"]',
'[slot="footer"]',
'[slot="button"]',
]) {
export class Dialog extends FocusVisiblePolyfillMixin(
ObserveSlotPresence(SpectrumElement, [
'[slot="hero"]',
'[slot="footer"]',
'[slot="button"]',
])
) {
public static get styles(): CSSResultArray {
return [styles, crossStyles];
}
Expand Down
3 changes: 2 additions & 1 deletion packages/dialog/src/DialogWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import '@spectrum-web-components/button/sp-button.js';
import '../sp-dialog.js';
import styles from '@spectrum-web-components/modal/src/modal.css.js';
import { Dialog } from './Dialog.js';
import { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';

/**
* @element sp-dialog-wrapper
Expand All @@ -35,7 +36,7 @@ import { Dialog } from './Dialog.js';
* @fires confirm - Announces that the "confirm" button has been clicked.
* @fires close - Announces that the dialog has been closed.
*/
export class DialogWrapper extends SpectrumElement {
export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
public static get styles(): CSSResultArray {
return [styles];
}
Expand Down

0 comments on commit b50e396

Please sign in to comment.