Giter Club home page Giter Club logo

Comments (4)

davidtheclark avatar davidtheclark commented on June 16, 2024

Hi, @hally9k. Thanks for the compliment! This conversation about initialFocus has already happened multiple times. Quick summary: I still don't think it's a good idea. Please search the closed issues and look through those comments, and if you feel like you have new reasons why this might be necessary, please re-open the issue.

from focus-trap.

hally9k avatar hally9k commented on June 16, 2024

Hi @davidtheclark,

Ok, so Let me try and outline a scenario in which this is a valid use case.

We are working on an app in which information about a person is collected. A person's info is displayed in a modal which requires a focus trap to function nicely. This modal is used to view the person's info as well as being live for editing that person's data. The viewing use case is more frequent than the editing use case. We are aware that focussing the initial input when the user is merely viewing the info opens the door to potential unintentional edits and lose precious info.

Below is a screen shot to illustrate the scenario where a user might only be viewing info but in danger of unintentionally editing it. As you might glean from the image there are certain scenarios in which this loss of data could have a high impact.

screen shot 2017-04-14 at 7 35 44 pm

from focus-trap.

davidtheclark avatar davidtheclark commented on June 16, 2024

@hally9k: I think in this case you should put initial focus on the modal container itself (with a tabindex of -1). Demo 4 exemplifies this: https://davidtheclark.github.io/focus-trap/demo/

from focus-trap.

hally9k avatar hally9k commented on June 16, 2024

@davidtheclark Thanks for the prompt reply. How would I achieve your suggested solution using your react wrapper? Apologies if I am overlooking something obvious...

from focus-trap.

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.