mirror of
https://github.com/tabler/tabler.git
synced 2026-08-29 13:21:29 +04:00
Improve accessibility across layouts, components, and forms (#2799)
This commit is contained in:
@@ -9,17 +9,19 @@ interface Props {
|
||||
class?: string
|
||||
show?: boolean
|
||||
style?: string
|
||||
/** id of the title element the root references via aria-labelledby; defaults to `modal-${modalId}-title` */
|
||||
titleId?: string
|
||||
}
|
||||
|
||||
const { modalId = 'simple', size, top, scrollable, class: className, show, style } = Astro.props
|
||||
const { modalId = 'simple', size, top, scrollable, class: className, show, style, titleId = `modal-${modalId}-title` } = Astro.props
|
||||
|
||||
const modalClass = ['modal modal-blur fade', className, show && 'show'].filter(Boolean).join(' ')
|
||||
const dialogClass = ['modal-dialog', size && `modal-${size}`, !top && 'modal-dialog-centered', scrollable && 'modal-dialog-scrollable'].filter(Boolean).join(' ')
|
||||
---
|
||||
|
||||
<!-- BEGIN MODAL -->
|
||||
<div class={modalClass} style={style} id={`modal-${modalId}`} tabindex="-1" role="dialog" aria-hidden={show ? 'false' : 'true'}>
|
||||
<div class={dialogClass} role="document">
|
||||
<div class={modalClass} style={style} id={`modal-${modalId}`} tabindex="-1" role="dialog" aria-modal="true" aria-labelledby={titleId} aria-hidden={show ? undefined : 'true'}>
|
||||
<div class={dialogClass}>
|
||||
<div class="modal-content">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user