mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-02 23:08:14 +00:00
feat(toc,explorer): add accessibility for toggle (#1327)
* Restore focus highlight on explorer toggle button. Remove `unset: all` declaration causing `outline` property to be unset. This allows the default browser focus highlight to be shown. * Fix semantics of expandable sections (explorer, toc). This adds the appropriate aria attributes for the [disclosure pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-image-description/#javascriptandcsssourcecode) and uses `visibility: hidden` to remove the hidden elements from the focus order without disrupting the animations. Further work is needed on the tree view nodes. * Run prettier for SCSS files.
This commit is contained in:
parent
12904ab796
commit
27a41abb62
6 changed files with 39 additions and 4 deletions
quartz/components/scripts
|
@ -17,6 +17,10 @@ const observer = new IntersectionObserver((entries) => {
|
|||
|
||||
function toggleExplorer(this: HTMLElement) {
|
||||
this.classList.toggle("collapsed")
|
||||
this.setAttribute(
|
||||
"aria-expanded",
|
||||
this.getAttribute("aria-expanded") === "true" ? "false" : "true",
|
||||
)
|
||||
const content = this.nextElementSibling as MaybeHTMLElement
|
||||
if (!content) return
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ const observer = new IntersectionObserver((entries) => {
|
|||
|
||||
function toggleToc(this: HTMLElement) {
|
||||
this.classList.toggle("collapsed")
|
||||
this.setAttribute(
|
||||
"aria-expanded",
|
||||
this.getAttribute("aria-expanded") === "true" ? "false" : "true",
|
||||
)
|
||||
const content = this.nextElementSibling as HTMLElement | undefined
|
||||
if (!content) return
|
||||
content.classList.toggle("collapsed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue