Giter Club home page Giter Club logo

Comments (7)

theKashey avatar theKashey commented on June 16, 2024 1

Correct. And later it used in react-focus-lock as const isFreeFocus = () => focusOnBody() || focusIsHidden(); which is later used in a little complicated condition - https://github.com/theKashey/react-focus-lock/blob/master/src/Trap.js#L100

It's more that possible that you trigger other parts of it. That would be interesting to know what exactly is happening, but there is only one way it should work – if as per documentation and my own understanding no-focus-lock means no-focus-lock, then it should be so.

I'll correct code.

from react-focus-lock.

theKashey avatar theKashey commented on June 16, 2024

👋 hello Julia. This is another reminder how bad I am with the documentation 😭

Anyway - your issue seems to be quite close to #213. Here what you can do:

  • add data-no-focus-lock on your iframe (documented at https://github.com/theKashey/focus-lock#focus-fighting), this will focus operations within marked location without triggering the lock.
  • as you might note - this attribute is quite specific to focus-lock library, so I might propose a little more complicated solution. But I am really not sure if you able to use it or not - "focus fighting"

The idea is following

This is not something ease to implement:

  • you need to add blur event to your iframe
    • focus iframe onblur
  • focus iframe
    • focus-lock will steal focus
    • onblur event will put it back
    • focus-lock will detect focus-fighting and self-disable
  • remove onblur event

This is all I can help with. Good luck.

from react-focus-lock.

juliacarbajal avatar juliacarbajal commented on June 16, 2024

Hi, thanks a lot for the advice! It seems the data-no-focus-lock only works if we add the package to our repo, which is sadly not an option so I'll see if I can do the focus fighting. Thanks again!

from react-focus-lock.

theKashey avatar theKashey commented on June 16, 2024

data-no-focus-lock is an html attribute and does not need anything except it to be added. No javascript should be involved at all.

from react-focus-lock.

juliacarbajal avatar juliacarbajal commented on June 16, 2024

Oh uhm then for some reason it's not working (I tried adding this attribute to our iframe but it didn't fix the problem).

from react-focus-lock.

juliacarbajal avatar juliacarbajal commented on June 16, 2024

Looking at the source code, it would seem this attribute is saved in a constant called FOCUS_ALLOW which is only used inside a function called focusIsHidden, but I couldn't find anywhere in the code (except tests) where this function was used. If it's not too much to ask, could you double-check that you're actually using this function somewhere? I'm trying to understand why it's not working for us. Thanks again!

from react-focus-lock.

stale avatar stale commented on June 16, 2024

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.

from react-focus-lock.

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.