diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index 3dbb5393b..e247d2e9e 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -10,6 +10,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Fixed a bug that caused `` to render the wrong size when `--track-width` was increased [#656](https://github.com/shoelace-style/shoelace/issues/656) - Implemented stricter linting to improve consistency and reduce errors, which resulted in many small refactors throughout the codebase [#647](https://github.com/shoelace-style/shoelace/pull/647) +- Improved accessibility of `` and `` by making the title an `

` and adding a label to the close button - Restored the nicer animation on `` and verified it works in Safari - Updated minimum Node version to 14.17 diff --git a/src/components/dialog/dialog.styles.ts b/src/components/dialog/dialog.styles.ts index b632884b6..dbf14bfad 100644 --- a/src/components/dialog/dialog.styles.ts +++ b/src/components/dialog/dialog.styles.ts @@ -61,9 +61,11 @@ export default css` .dialog__title { flex: 1 1 auto; + font: inherit; font-size: var(--sl-font-size-large); line-height: var(--sl-line-height-dense); padding: var(--header-spacing); + margin: 0; } .dialog__close { diff --git a/src/components/dialog/dialog.ts b/src/components/dialog/dialog.ts index 135c7c757..f9e221542 100644 --- a/src/components/dialog/dialog.ts +++ b/src/components/dialog/dialog.ts @@ -12,6 +12,7 @@ import { HasSlotController } from '~/internal/slot'; import { isPreventScrollSupported } from '~/internal/support'; import { watch } from '~/internal/watch'; import { setDefaultAnimation, getAnimation } from '~/utilities/animation-registry'; +import { LocalizeController } from '~/utilities/localize'; const hasPreventScroll = isPreventScrollSupported(); @@ -64,6 +65,7 @@ export default class SlDialog extends LitElement { @query('.dialog__overlay') overlay: HTMLElement; private readonly hasSlotController = new HasSlotController(this, 'footer'); + private readonly localize = new LocalizeController(this); private modal: Modal; private originalTrigger: HTMLElement | null; @@ -230,13 +232,14 @@ export default class SlDialog extends LitElement { ${!this.noHeader ? html`
- +

${this.label.length > 0 ? this.label : String.fromCharCode(65279)} - +

diff --git a/src/components/drawer/drawer.styles.ts b/src/components/drawer/drawer.styles.ts index 159ab8bc9..a7e07cf02 100644 --- a/src/components/drawer/drawer.styles.ts +++ b/src/components/drawer/drawer.styles.ts @@ -92,9 +92,11 @@ export default css` .drawer__title { flex: 1 1 auto; + font: inherit; font-size: var(--sl-font-size-large); line-height: var(--sl-line-height-dense); padding: var(--header-spacing); + margin: 0; } .drawer__close { diff --git a/src/components/drawer/drawer.ts b/src/components/drawer/drawer.ts index fb6e018e0..5bf0cf0ae 100644 --- a/src/components/drawer/drawer.ts +++ b/src/components/drawer/drawer.ts @@ -13,6 +13,7 @@ import { uppercaseFirstLetter } from '~/internal/string'; import { isPreventScrollSupported } from '~/internal/support'; import { watch } from '~/internal/watch'; import { setDefaultAnimation, getAnimation } from '~/utilities/animation-registry'; +import { LocalizeController } from '~/utilities/localize'; const hasPreventScroll = isPreventScrollSupported(); @@ -72,6 +73,7 @@ export default class SlDrawer extends LitElement { @query('.drawer__overlay') overlay: HTMLElement; private readonly hasSlotController = new HasSlotController(this, 'footer'); + private readonly localize = new LocalizeController(this); private modal: Modal; private originalTrigger: HTMLElement | null; @@ -256,14 +258,15 @@ export default class SlDrawer extends LitElement { ${!this.noHeader ? html`
- +

${this.label.length > 0 ? this.label : String.fromCharCode(65279)} - +