Giter Site home page Giter Site logo

Comments (4)

ronilaukkarinen avatar ronilaukkarinen commented on June 1, 2024

Have you tested it on latest air-light version without modifications? Have you figured out what causes it, is it moveTo or something else? 🤔 On Dude website the new Air-light back to top wasn't yet used. The focus should always go to the first focusable element for accessibility reasons. #page is not that.

Have to test this further when I have time. If you have a bulletproof solution to this, feel free to send a PR :)

from air-light.

raikasdev avatar raikasdev commented on June 1, 2024

Doesn't happen on latest air-light. Doesn't work for me on commit 7902d56, but seems to work on 1d770f8 (commit before the latest changes to _accessibility 🤷). I'll try to find the root cause to understand what breaks it.

from air-light.

raikasdev avatar raikasdev commented on June 1, 2024

Problem is caused when moveto tries to get window's (container) pageYOffset, meaning amount of pixels from the top of the screen (how much the user has scrolled), and on Firefox it seems the value being returned is 10 for some reason, and on Chromium it's 0.

When it's 10, this clause returns the move function, because lastYOffset (now being 10 returned by last loop) is smaller currentYOffset. If the value is 0, the "if (lastYOFfset)" clause will not run, because 0 is a nullish value in JavaScript 👍

Because of this I believe some styles made by developers after starting to style the website may cause the scrolling to break.

from air-light.

raikasdev avatar raikasdev commented on June 1, 2024

I have identified why this happens is not 100% moveTo's fault. When the user get's focused to the skip to content link, Firefox places the user 5 pixels scrolled down (margin?).

This can be fixed by focusing the user only after the animation has finished (callback). I'll create a PR

from air-light.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.