-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
Adds custom styles for <details>
and <summary>
elements in Markdown content
#1735
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 535328d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Following a Talking and Doc'ing session (April 11, 2024), some very interesting feedback was received from the participants, thank you all for your time and feedback! One particular piece of feedback from @kevinzunigacuellar was that it may be difficult to follow if a user is still in a Borders around all
|
Sharing here another great approach to the design by @delucis The preview is available here: https://starlight-git-chris-details-dabbling-astrodotbuild.vercel.app/reference/details/ An early feedback for this variation is that it may be less obvious that these are clickable without a more involved CTA compared for example to a Google variation: |
* main: (32 commits) i18n(pt-br): Update `getting-started.mdx` (withastro#1776) i18n(es): update `configuration` (withastro#1766) [ci] format Add TrueCharts to showcases (withastro#1773) i18n(zh-cn): Update `sidebar.mdx` (withastro#1761) i18n(ko-KR): update `sidebar.mdx` (withastro#1760) i18n(fr): update `guides/sidebar` (withastro#1758) test: fix Windows path separator test issues (withastro#1759) i18n(fr): Update `reference/configuration.mdx` from withastro#1729 (withastro#1757) docs: rewrite `guides/sidebar` examples to be more generic (withastro#1751) i18n(ja): Update community-content.mdx (withastro#1756) i18n(ja): Update configuration.mdx (withastro#1755) i18n(zh-cn): Update `configuration.mdx` (withastro#1753) i18n(ko-KR): update `configuration.mdx` (withastro#1752) docs: add caution about scripts processing when using head config (withastro#1729) i18n(es): update `community-content` (withastro#1740) i18n(pt-br): Update `resources/community-content.mdx` (withastro#1747) format: quick fix [ci] format [ci] format ...
Co-authored-by: Chris Swithinbank <[email protected]>
* main: (60 commits) Add type checking job to the CI workflow (withastro#1827) [ci] format i18n(pt-BR): Update `components.mdx` (withastro#1815) [ci] format i18n(ru): update translations (withastro#1825) i18n(pt-BR): Update `css-and-tailwind.mdx` (withastro#1817) i18n(es): updates `pages` (withastro#1823) i18n(es): update `i18n` (withastro#1822) i18n(es): updates `overrides` (withastro#1820) i18n(es): update `guides/components` and add `syncKey` to various pages (withastro#1818) [ci] format i18n(es): update `community-content` (withastro#1824) i18n(es): update `configuration` (withastro#1821) i18n(es): update `frontmatter` (withastro#1819) i18n(fr): update `guides/pages.mdx` (withastro#1800) i18n(fr): update `reference/overrides.md` (withastro#1803) i18n(fr): update `reference/frontmatter.md` (withastro#1802) i18n(fr): update `reference/configuration.mdx` (withastro#1801) i18n(fr): update `guides/i18n.mdx` (withastro#1799) i18n(fr): update `guides/components` and add `syncKey` to various pages (withastro#1797) ...
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Updated the PR and tweaked border colors: the Hovering an opened And finally, I fixed a marker position issue with long summaries due to MDX wrapping the summary in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the work on this @HiDeoo!
I’ll summarise again the couple of changes that we discussed and I pushed directly:
- border is now 2px instead of 1px, matching the
<Tabs>
component thickness - hover styling only applies when hovering
<summary>
on expanded<details>
— this helps avoid a slightly chaotic/flickering feeling with the border colour changing rapidly as users move over details - hover colour is now a more bold accent like
<Tabs>
uses for selected tabs
Other than that I think we’re more or less there! I left a couple of notes on the docs and some CSS, but then I think we should be good to clean up the test page.
We’ll probably also need to bump up the CSS size-limit budget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for docs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working through the different iterations and rolling with the changes I kept throwing at you @HiDeoo! 🎉
It will be nice to see these updated and in-use in Astro’s docs soon too.
* main: (45 commits) i18n(tr): add `showcase.mdx` (withastro#1896) [ci] format i18n(zh-cn): Update `authoring-content.md` (withastro#1901) [ci] format [ci] release (withastro#1897) [ci] format i18n(tr): update `authoring-content.md` (withastro#1887) Micro-optimization: clean up `<details>` CSS (withastro#1892) [ci] format i18n(tr): update `components.md` file (withastro#1889) [ci] format i18n(tr): add css-and-tailwind (withastro#1893) [ci] format [ci] release (withastro#1890) Adds custom styles for `<details>` and `<summary>` elements in Markdown content (withastro#1735) Update @astrojs/mdx to v3 (withastro#1846) [ci] format [ci] release (withastro#1869) Add BlueSky social icon (withastro#1871) [ci] format ...
What kind of changes does this PR include?
Description
This PR adds custom styles for
<details>
and<summary>
elements in Markdown content, adresssing the request in the built-in components discussion.Preview playground page: https://starlight-git-fork-hideoo-hd-style-details-astrodotbuild.vercel.app/reference/details/
The approach used does not add a new
<Details>
component but relies on the native<details>
and<summary>
HTML elements, similar to the Docusaurus approach.The current design is based on the Astro Docs custom implementation but the implementation is not exactly identical as I noticed a few minor issues while implementing it (some margins inconsistencies and some border being offset by 1px when toggling the details).
This PR also adds support for RTL languages,
prefers-reduced-motion
and some minor color adjustments to match the Starlight theme.One point to note is also the usage of
<details>
in asides, where the styling deviates from Astro Docs as it can lead to some readability issues. I implemented custom variations to address this, but I don't think it looks the best as I did not introduce any new color (which may be needed to make it more appealing) and I'm also not the best when it comes to design decisions.I reviewed the accessibility of the implementation using this checklist and testing with screen readers but relying on the native elements ensures most of the concerns are addressed out of the box.
Any feedback is welcome!