Giter VIP home page Giter VIP logo

Comments (13)

ZeroX-DG avatar ZeroX-DG commented on June 19, 2024 1

I've just tested it by adding these two lines in password example:

Screenshot 2024-04-26 at 1 04 30 AM

Works great! You probably want to start handling the Tab key event in places like use_editable too, so it insert a \t for Input & Textarea.

from freya.

ZeroX-DG avatar ZeroX-DG commented on June 19, 2024 1

Ah yeah, I was just too lazy to make the onkeydown handler hahaha.

That was a really fast fix! Thank you for the awesome work!

from freya.

ZeroX-DG avatar ZeroX-DG commented on June 19, 2024

Ah so it's not that it's not listened. It's used to detect navigation within the app

if state == ElementState::Pressed
&& physical_key == PhysicalKey::Code(KeyCode::Tab)

This prevented tab being treated as a real key input 😢

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

Ah so it's not that it's not listened. It's used to detect navigation within the app

if state == ElementState::Pressed
&& physical_key == PhysicalKey::Code(KeyCode::Tab)

This prevented tab being treated as a real key input 😢

Yeah... I am aware of this but I haven't found a decent way yet to detect when to do one thing or another

I have thought about doing it with the Dioxus event propagation system but haven't tried yet

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

Let me try

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

Just opened #587 @ZeroX-DG

I made the keyboard navigation only work if the highest onkeydown doesn't stop the propagation of the event

It's not perfect but I think it's better

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

Actually the PR is not entirely correct

from freya.

ZeroX-DG avatar ZeroX-DG commented on June 19, 2024

Yeah the PR is more like allowing tab key event to go through & perform navigation at the same time. (I'm just guessing, I'm not really familiar with freya codebase haha)

I think it's closer to the behaviour on the web that way since the JS way is to allow tab key & navigation to happen at the same time & you should call event.preventDefault() if you don't want navigation to happen.

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

I have come up with a prevent_navigation method for the use_focus hook which should indeed prevent any navigation no matter where you call it from

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

I have yet to actually test it but I think it should work

from freya.

ZeroX-DG avatar ZeroX-DG commented on June 19, 2024

You can then support indenting lines in valin editor! 😄

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

I've just tested it by adding these two lines in password example:

Screenshot 2024-04-26 at 1 04 30 AM

Works great! You probably want to start handling the Tab key event in places like use_editable too, so it insert a \t for Input & Textarea.

Heads up: prevent_navigation is meant to be used inside of onkeydown events 😄.

I will add some docs and tests asap!

from freya.

marc2332 avatar marc2332 commented on June 19, 2024

You can then support indenting lines in valin editor! 😄

yeees! 🤣

from freya.

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.