-
Notifications
You must be signed in to change notification settings - Fork 345
Revert hover link approach to fix markup of headings containing links #1752
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
Revert hover link approach to fix markup of headings containing links #1752
Conversation
💚 💙 💜 💛 ❤️ |
Hi @DavidOliver, I am sorry but I went back and revert this. Because with this change, we can no longer click on the title to get the anchor. So I prefer to have broken but functional markup, then correct markup that is non-functional. :) |
@josevalim I understand. My thinking was that obtaining the fragment identifier is easy enough by clicking on the link icon. If I'm able to add the behaviour you would like via JS, would you be open to then accepting so that malformed headings/links are not broken into separate anchors, and so that links in headings are correctly rendered? |
@josevalim I thought about your message again, and I realised that I'm not sure whether or not you realised the link to the section heading can still be obtained by clicking on the link icon to the left which appears on hover. No functionality has been lost with this change, and it does fix a significant problem with links in headings, so I think it's better with the fix than without. :) |
I am worried about mobile devices, given the anchor only appears on mouse over, and being less discoverable in general. But fixing it with JS would also be fine by me. :) There are other places we don't show the anchor, such as cheatsheets and admonitions, so we would need answers for those to if we don't add the JS. |
@josevalim, got it. I'll give it some more thought and experiment. Maybe we show the link icon semi-transparently until hover? |
I think it feels really cluttered on mobile. :( |
@josevalim, sorry for the delay. I have a new approach in progress that makes only markup and CSS changes and that preserves the fragment identifier/section link on hover of the main heading text. It makes basic use of CSS Grid to overlay the heading text on the section link (the overall hoverable area), and sets I'll submit a new PR when I've tidied and tested in more browsers/devices. |
Thats awesome @DavidOliver. No worries and thank you for the updates and your contributions! |
@josevalim, before I update the tests and submit a PR, could you check that you're happy with the appearance and markup, please? The hover link's chain icon appears only when hovering a part of the heading that is not itself "a link". I've restored the hover link chain icon for cheatsheet H3s. Example HTML: |
Hi @DavidOliver, this looks good to me. As long as it looks and behaves the same as today, we should be more than fine. Also, make sure to see the generated epub and check if it looks good too. :) |
@josevalim, given the approach above, headings in the epub appear like this: So the heading itself, generated via I think this may not be a problem as the epub Module pages' heading markup, generated via an epub-specific template, remains untouched: So, for example, the 'Callbacks' and 'Functions' headings here continue to link to the relevant sections below. Is this all okay to go ahead with? |
Yes, it is fine. None of those links are useful because they mostly exist for getting the anchor. We could also remove the links from Summary/Function/etc in the ebook. Would you like to go ahead with this change too? Otherwise I can open a separate issue. :) Thank you! |
@josevalim, great - thanks. Yes, I'll submit a separate PR for removing the self-pointing links in epub module page headings. |
Fixes 28bb43e#r125061077
Also makes the link underline color the same as the text (usinig
currentColor
, which is black or white) for admonition headings.