mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Fix disabled DragValue eating focus, causing focus to reset (#5826)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> * Closes https://github.com/emilk/egui/issues/5507 * [x] I have followed the instructions in the PR template
This commit is contained in:
committed by
GitHub
parent
f408ccafbc
commit
6a8ee29a4e
@@ -451,10 +451,11 @@ impl Widget for DragValue<'_> {
|
||||
// it is immediately rendered in edit mode, rather than being rendered
|
||||
// in button mode for just one frame. This is important for
|
||||
// screen readers.
|
||||
let is_kb_editing = ui.memory_mut(|mem| {
|
||||
mem.interested_in_focus(id, ui.layer_id());
|
||||
mem.has_focus(id)
|
||||
});
|
||||
let is_kb_editing = ui.is_enabled()
|
||||
&& ui.memory_mut(|mem| {
|
||||
mem.interested_in_focus(id, ui.layer_id());
|
||||
mem.has_focus(id)
|
||||
});
|
||||
|
||||
if ui.memory_mut(|mem| mem.gained_focus(id)) {
|
||||
ui.data_mut(|data| data.remove::<String>(id));
|
||||
|
||||
Reference in New Issue
Block a user