fix: resolve the failure of skip-to-content button - #665
Conversation
satnaing
left a comment
There was a problem hiding this comment.
Thanks for tracking this down. Nice catch.
I just left a couple of minor suggestions.
satnaing
left a comment
There was a problem hiding this comment.
Can you drop all mb-0.5 in this PR please?
I don't see any problem without having a bottom margin in these layout.
Also, can you add an outline styling to #main-content so that the outline style stays consistent across the site.
You can just add #main-content in global.css just like this
@layer base {
/* other styles */
a,
button,
#main-content {
@apply outline-accent outline-offset-1 focus-visible:no-underline focus-visible:outline-2 focus-visible:outline-dashed;
}
/* other styles */
}|
The Tags page may be a special example without any problem. But in the index page, the outline of If you'd rather I not use |
- Guard skip link against modified clicks so new-tab opens still work - Strip tabindex from <main> on blur - Modify the scroll behavior from instant to smooth - Add some margin to make the focus outline won't be covered. - Beauty the outline style.
1c36221 to
aaaf5e2
Compare
|
The only affected pages are So, what's your preference? Would you rather add margins to each affected page individually, instead of applying a single |
|
We'll just add extra margins ( |
|
OK. I added margins for the affected pages. I used |
|
Looks good. |
- Add extra margins for the pages without `Breadcrumb` and `BackButton`, instead of adding margin for all `main-content`s, making the outline of `main` not covered by `Header` and `Footer`.
bae15af to
32d30d1
Compare
|
I'm very sorry, that was my fault. I forgot to make the changes to |







Description
The existing skip-to-content button only used an anchor link to scroll to
#main-content, but did not move keyboard/screen-reader focus to the main content. This meant that after activation, the focus remained on the skip link itself, failing to actually bypass the header navigation for assistive technology users.This PR updates
Header.astroto properly shift focus by adding a click handler for existing skip-to-content button.Types of changes
Checklist