[docs-infra] Make the whole header clickable#39603
Conversation
Netlify deploy previewhttps://deploy-preview-39603--material-ui.netlify.app/ Bundle size report |
alexfauquette
left a comment
There was a problem hiding this comment.
Sorry for the delay, My comments were in pending state since few days I don't know why 🫣
Basically tests are not an issue, we can fix them after agreeing on the new DOM structure 👍
@alexfauquette so am i suppose to leave this tests on you guys ? |
alexfauquette
left a comment
There was a problem hiding this comment.
Could you do the same modification to ClassesSection, CSSSection, PropertiesSection and SlotSection which are the same kind of title but for API page rendering
Basically the idea would be that all the "anchor-link" of the codebase get modified the same way
Yes, we can fix them when PR is ready to be merged |
danilo-leal
left a comment
There was a problem hiding this comment.
Quick design note, though — Ideally, we'd be able to pull this off without any design changes (like adding an underline or removing styles from the anchor button). 😬
|
In terms of UX, I would be in favor of implementing this in a way that doesn't impact the header text selection experience. I feel that selecting a header as a text copy is as much a frequent use case as wanting to copy the header anchor. |
|
@danilo-leal I moved forward this PR I've modified 3 kind of pages:
The design should be unchanged, except that:
|
danilo-leal
left a comment
There was a problem hiding this comment.
Looking great! 👍 Sorry it took me a few days to look at your latest iteration.
There was a problem hiding this comment.
(I'm landing here from a bug I noticed on the docs, trying to find the origin).
It's great to have the headers clickable, it saves time. But I think that it's too eager, I think that we should:
- Be able to use double click to select the whole header
- Be able to select any words of a header
- When selecting any words of a header not triggering the header anchor
I feel like I frequently copy and paste content in the headers to search. It's impossible now if the content is in the middle:
Screen.Recording.2024-04-21.at.01.52.15.mov
https://deploy-preview-39603--material-ui.netlify.app/material-ui/react-button/#cursor-not-allowed
Stripe docs is the closest to a great execution that I could find (do 1 and 2 well), the only thing I would fix there is click to select shouldn't click if some text is selected (fail at 3).
In our case, we fail at 1, 2, and 3. Can we fix this? Thanks
Also see the invalid HTML structure: #39603 (comment).
| </svg> | ||
| <a aria-labelledby={hash} className="title-link-to-anchor" href={`#${hash}`} tabIndex={-1}> | ||
| {getTranslatedHeader(t, hash)} | ||
| <div className="anchor-icon"> |
There was a problem hiding this comment.
We can't do this: https://validator.w3.org/nu/?doc=https%3A%2F%2Fnext--material-ui.netlify.app%2Fmaterial-ui%2Fgetting-started%2F
I guess this would fix the regression:
| <div className="anchor-icon"> | |
| <span className="anchor-icon"> |
Fixing this in #42085.
| '& a, & a code': { | ||
| '& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': { |
There was a problem hiding this comment.
I'm reverting this approach, it increased the specificity, leading to overrides other styles: #42735. It seems that we don't need this more complex CSS selector, we can solve the same problem with the CSS injection order.
Added a feature by which user can click on heading too.
fix #39350
Preview: https://deploy-preview-39603--material-ui.netlify.app/material-ui/react-autocomplete/
Untitled_.Oct.25.2023.1_06.PM.webm