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

Linked headlines refactor #4287

Merged
merged 39 commits into from
Jun 23, 2023
Merged

Linked headlines refactor #4287

merged 39 commits into from
Jun 23, 2023

Conversation

nileshgulia1
Copy link
Member

@nileshgulia1 nileshgulia1 commented Jan 20, 2023

  • Use <UniveralLink/> in linked heading anchor since we are now using Links generated by react-router-hashlink.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit b787548
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/648ded896d3e8800088698f2

@cypress
Copy link

cypress bot commented Jan 20, 2023

Passing run #5717 ↗︎

0 507 20 0 Flakiness 0

Details:

refactor: move useClipboard hook to volto/src/hooks
Project: Volto Commit: b787548693
Status: Passed Duration: 12:31 💡
Started: Jun 17, 2023 5:32 PM Ended: Jun 17, 2023 5:45 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@avoinea avoinea requested a review from tiberiuichim March 7, 2023 21:15
@nileshgulia1
Copy link
Member Author

This just needs a towncrier news item, can be added collectively in #3540.
@sneridagh @tiberiuichim safe to merge?

@nileshgulia1
Copy link
Member Author

@ksuess I remember you asked for moving the "slug icon" to the right just like mdn docs. Would you mind reviewing this PR then?

@nileshgulia1 nileshgulia1 requested a review from ksuess March 20, 2023 10:50
Copy link
Member

@ksuess ksuess 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 great, I would take it as it is.
But an opt-out (no chain icon on hover) would be handsome.

src/helpers/ScrollToTop/ScrollToTop.jsx Show resolved Hide resolved
src/components/manage/Blocks/Title/View.jsx Show resolved Hide resolved
transform: rotate(45deg);
visibility: hidden;
}
}
}
Copy link
Member

@ksuess ksuess Mar 21, 2023

Choose a reason for hiding this comment

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

I would prefer a link icon aligned and with same size of the headline or just slightly increased in size.

Cosmetics: the link icon is rotated. Even if the shape of the icon is unusual, it's a global design decission.

grafik

Copy link
Contributor

Choose a reason for hiding this comment

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

@ksuess it's relatively difficult to make the link icon properly wrap with the text, so if it's multiple lines, it doesn't behave well. But my css knowledge may be limited, maybe there's a hack to do it

aria-hidden="true"
tabIndex={-1}
href={`#${slug}`}
>
<svg
{...linkSVG.attributes}
dangerouslySetInnerHTML={{ __html: linkSVG.content }}
width="2em"
Copy link
Member

@ksuess ksuess Mar 21, 2023

Choose a reason for hiding this comment

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

overriden by less CSS: "width="2em""

@nileshgulia1
Copy link
Member Author

But an opt-out (no chain icon on hover) would be handsome.

"no chain icon on hover" - hm.. I don't see a reason why users will don't need it. @ksuess Could you give an example of sites where there is no link icon on hover but are anchors. Maybe I can just make that icon configurable? So a "#" in place of a chain icon.

@ksuess
Copy link
Member

ksuess commented Mar 22, 2023

But an opt-out (no chain icon on hover) would be handsome.

"no chain icon on hover" - hm.. I don't see a reason why users will don't need it. @ksuess Could you give an example of sites where there is no link icon on hover but are anchors. Maybe I can just make that icon configurable? So a "#" in place of a chain icon.

Sorry, what I mean instead is: In my opinion, "linked headlines" should be optional. Or at least opting out should be possible.

I understand that this topic should go in a main issue, but I am confused where the current main development happens. Feel free to move this comment to where it belongs, thank you.

@sneridagh
Copy link
Member

I also think it should be optional, not sure if "opt-in" or "opt-out"... I can certainly think it sites that do not need it (brochure, etc).

@nileshgulia1
Copy link
Member Author

@sneridagh Now that I started to implement this, I'm a bit puzzled having both "copy to clipboard" and "scroll to anchor" events triggering on clicking anchor icon. @albertcasado when an anchor is at the bottom of the page, clicking on it scrolls to that anchor. Could triggering a toast simultaneously annoy a user? 🤔

@nileshgulia1 nileshgulia1 requested a review from stevepiercy June 7, 2023 15:58
@nileshgulia1
Copy link
Member Author

@sneridagh I have pushed the changelog. Would you mind reviewing it, please?

Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

I made a few suggestions and questions for your consideration.

news/4287.feature Outdated Show resolved Hide resolved
src/helpers/MessageLabels/MessageLabels.js Show resolved Hide resolved
@nileshgulia1
Copy link
Member Author

@stevepiercy I resolved your comments in de9e57f. Could you please have a look? Thanks!

@nileshgulia1
Copy link
Member Author

nileshgulia1 commented Jun 9, 2023

@sneridagh Now that I started to implement this, I'm a bit puzzled having both "copy to clipboard" and "scroll to anchor" events triggering on clicking anchor icon. @albertcasado when an anchor is at the bottom of the page, clicking on it scrolls to that anchor. Could triggering a toast simultaneously annoy a user? 🤔

@stevepiercy @sneridagh Anyways, what do you think of this opinion, As a user? Can we disable toast and instead show a copied "SVG" near the anchor.

Current scenario

Screen.Recording.2023-06-09.at.8.57.08.PM.mov

@stevepiercy
Copy link
Collaborator

@sneridagh Now that I started to implement this, I'm a bit puzzled having both "copy to clipboard" and "scroll to anchor" events triggering on clicking anchor icon. @albertcasado when an anchor is at the bottom of the page, clicking on it scrolls to that anchor. Could triggering a toast simultaneously annoy a user? 🤔

@stevepiercy @sneridagh Anyways, what do you think of this opinion, As a user? Can we disable toast and instead show a copied "SVG" near the anchor.

Current scenario

Screen.Recording.2023-06-09.at.8.57.08.PM.mov

For code blocks in docs, we have this interface, which is nice. It has both the universal icon for copy, plus translatable text. You can play with it at the permalink:

https://6.docs.plone.org/volto/configuration/how-to.html#extending-configuration-in-a-project

Screen.Recording.2023-06-09.at.11.41.29.PM.mov

I think the toast at the bottom is too much and disconnected from the click on large screens.

Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

I approve docs and naming conventions. A maintainer should review source code, too. Thank you!

@nileshgulia1
Copy link
Member Author

Thank you @stevepiercy .

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

I took a look and I like it! I do have a few suggestions...

Should we close #3540 and edit this PR to set the target branch to master? I don't think merging it into #3540 first has any particular benefit.

packages/volto-slate/src/editor/render.jsx Outdated Show resolved Hide resolved
packages/volto-slate/src/editor/less/slate.less Outdated Show resolved Hide resolved
src/components/manage/Blocks/Title/View.jsx Show resolved Hide resolved
@davisagli
Copy link
Member

Anyways, what do you think of this opinion, As a user? Can we disable toast and instead show a copied "SVG" near the anchor.

@nileshgulia1 I think it would be nice to have it closer to where the user clicks, but I am not sure how to guarantee that there is space to show it. The toast is okay and has the benefit of (hopefully) following existing practices for a11y rather than needing to make sure something new is accessible...I would keep the toast for now and come back to it as a future improvement.

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

LGTM now

@sneridagh sneridagh merged commit 9d4e659 into linked-headlines Jun 23, 2023
@sneridagh sneridagh deleted the linkedHeadlinesRefactor branch June 23, 2023 11:05
@cypress cypress bot mentioned this pull request Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants