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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃拕 Make :target elements stand out #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vegerot
Copy link
Sponsor Contributor

@vegerot vegerot commented Nov 11, 2021

On a tall monitor (where you can fit the content of the whole screen
without scrolling), it can be difficult seeing where a particular in-page
link takes you. This commit makes these elements stand out more

Video demonstration:

quick-lint-js_.find.JavaScript.bugs.and.22.more.pages.-.Personal.-.Microsoft.Edge.2021-11-10.20-02-52.mp4

Notes for reviewer:

  • There is a small layout shift with the transition. However the shift is contained within the single section you select; so impact to CLS should be small if any (note: unmeasured)
  • using the h4 selector may be too broad. A quick grep shows right now there is no leakage, but it may be prudent to add a class to these elements to prevent this behavior showing up in unexpected places in the future
rg "h4 id"
public/install/neovim/common-manual.ejs.html
18:<h4 id="manual-neovim-package">Install as a Neovim package</h4>
49:<h4 id="manual-neovim-dein-vim">Install with dein.vim</h4>
69:<h4 id="manual-neovim-packer-nvim">Install with packer.nvim</h4>
94:<h4 id="manual-neovim-vim-plug">Install with Vim-Plug</h4>

public/install/vim/common-manual.ejs.html
17:<h4 id="manual-vim-package">Install as a Vim package</h4>
49:<h4 id="manual-vim-pathogen">Install with Pathogen</h4>
72:<h4 id="manual-vim-vim-plug">Install with Vim-Plug</h4>
90:<h4 id="manual-vim-vundle">Install with Vundle</h4>

Copy link
Collaborator

@strager strager left a comment

Choose a reason for hiding this comment

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

I like the idea, but not the implementation.

Comment on lines +170 to +344
h4:target::before {
content: "馃憠"; /*TODO(馃槑): localize for different layout directions (e.g. rtl)*/
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should add a background to the h4 instead. Maybe rgba(0,0,0,0.1) for light mode and rgba(255,255,255,0.1) for dark mode.

transition-duration: 333ms;
transition-timing-function: ease;
box-shadow: 0 0.8rem 1.0rem 0.1rem rgba(0, 0, 0, 0.2);
transform: translateY(-0.4rem);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm very confused about the styling here. It feels very out of place.

  • Why a box shadow? It looks uncanny having a shadow surrounding text and extending to the right (in the middle of nowhere).
  • Why does the text move location? (I could understand the pointer moving (sliding into view).)

Comment on lines +174 to +348
transition-property: box-shadow, transform;
transition-duration: 333ms;
transition-timing-function: ease;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: If we have an animation, we should respect prefers-reduced-motion.

On a tall monitor (where you can fit the content of the whole screen
without scrolling), it can be difficult seeing where a particular in-page
link takes you.  This commit makes these elements stand out more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants