Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accessible <FileTree> component to replace ASCII art #2178

Merged
merged 12 commits into from
Dec 16, 2022
Merged

Conversation

delucis
Copy link
Member

@delucis delucis commented Dec 14, 2022

Summary

Authoring

Once you import the FileTree component into your file, authoring looks like this:

<FileTree>
- src/
  - pages/
    - **index.astro**
- astro.config.mjs This is the Astro config file
- package.json
</FileTree>
  1. A file or directory can be marked as highlighted by bolding it: **index.astro**.
  2. Any text following the first space in an item is treated as a comment and styled accordingly, see the astro.config entry above.

Screenshots

Here’s a before/after from the manual install guide:

Before After
image image

How does this work

The <FileTree> component expects to be passed an unordered list. It passes this list through a rehype pipeline that wraps directories in a <details> element to make them collapsible.

Each filename is passed to a utility based on the Seti UI VS Code icon system to get an icon for the detected file type. This is injected as an inline SVG.

This pipeline also separates the comments and interprets the bold filename as highlighted.

@netlify
Copy link

netlify bot commented Dec 14, 2022

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit ba8ac99
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/639ccda49218d5000942b80b
😎 Deploy Preview https://deploy-preview-2178--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@delucis delucis added the site improvement Some thing that improves the website functionality - ask @delucis for help! label Dec 14, 2022
@delucis delucis self-assigned this Dec 14, 2022
@sarah11918
Copy link
Member

Super excited for this @delucis! I tested all the docs pages, at various screen sizes and on my phone, and it all looks AMAZINGLY good to me! 🥳

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so cool!

Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with NVDA, it's perfect! Great work @delucis 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site improvement Some thing that improves the website functionality - ask @delucis for help!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[A11Y] File lists are currently inaccessible ASCII art representations
4 participants