n00kii / egui-modal

a simple modal library for egui
MIT License
65 stars 10 forks source link

Focus is not bounded in modal window #4

Open SDesya74 opened 1 year ago

SDesya74 commented 1 year ago

When a modal window is open, the user should not be able to interact with elements outside of this window.

Reproducing:

n00kii commented 1 year ago

this one is a bit difficult. i can lock focus to a dummy null Id or surrender focus from all widgets, but this will prevent textboxes and other certain widgets that need focus from working in the modal. i dont think egui exposes enough api for me to do this simply. if there was a way to set this line and this line to false every frame, it would make it really easy...

SDesya74 commented 1 year ago

Yesterday I was just looking at how it works in egui, also decided that the api provided is not enough. It would be nice to make some kind of general solution to bound the focus within the widget and all its children, but I still have absolutely no idea how to do it with current egui api.

Thank you very much for the answer, I will try to study this topic, and if I come up with something, I will make a pull request

n00kii commented 1 year ago

thanks!