Giter Site home page Giter Site logo

Comments (9)

theKashey avatar theKashey commented on June 7, 2024 1

As long as I am not aware of the problem - I'll handle it and fix soon. Like tomorrow should be ok-ish.
Thank you for letting me know

from react-focus-on.

theKashey avatar theKashey commented on June 7, 2024

Have you tried enabled prop? Look like it's almost working, but there is some problem with returnFocus (not working)
https://codesandbox.io/s/react-focus-on-react-spring-5m3uv

from react-focus-on.

alexandernanberg avatar alexandernanberg commented on June 7, 2024

Yeah tried with that but not returning focus is a deal breaker, you also get a Can't perform a React state update on an unmounted component. warning from react

from react-focus-on.

theKashey avatar theKashey commented on June 7, 2024

3.1.4 should fix it

from react-focus-on.

alexandernanberg avatar alexandernanberg commented on June 7, 2024

Awesome, thanks! 👍

A minor nitpick would be that the dialog content jumps little when closing it. I guess it's because the scroll-lock is removed before the element has fully unmounted. Would it be possible to solve this somehow too? This is not a deal breaker though, just a nice to have

from react-focus-on.

theKashey avatar theKashey commented on June 7, 2024

That's interesting. And easy doable. However, I could not propose any other syntax except additional prop to override scrollLock settings. Right now there is only one to disable it, not forcible enable...

<FocusOn
 enabled={controlsFocusLockAndScrollLock}
 forceScrollLock={controlsScrollLock}
>

from react-focus-on.

alexandernanberg avatar alexandernanberg commented on June 7, 2024

Thought a bit more about this and I don't think the scroll should be locked while the dialog is closing. So immediately when you close you should be able to scroll (like it's currently) but the scrollbar style applied to the dialog needs to stay until it's unmounted to avoid the jump. This will probably be messier to implement but will provide a better user-experience.

Do we still need the additional prop in this case? I think we should be able to just go with the enabled prop still

from react-focus-on.

theKashey avatar theKashey commented on June 7, 2024

Right now you can:

  1. set focusLock prop to false, this would disable focus lock, keeping scroll lock active
  2. set enabled to false after animation end.

That would solve your problem.

However, I could not unlock scroll and keep scrollbar hidden. The hidden scrollbar would keep scrolling disabled. However, you might mitigate the "jump" applying an extra classname to your Modal - https://github.com/theKashey/react-focus-on#exposed-from-react-remove-scroll, like you need the first one (classNames.fullWidth)

from react-focus-on.

alexandernanberg avatar alexandernanberg commented on June 7, 2024

Alright, adding the classname got me the closest to what I want, however I wasn't able to get the gapMode to use padding instead of margin. Maybe because the overlay is the parent of the FocusOn? I've updated the codesandbox with the changes. Last thing from this being the perfect solution 😄

from react-focus-on.

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.