You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #18753 from eska014/html5-iframefocus
Fix keyboard focus lock-out with HTML5 canvas in iframe
This commit is contained in:
@@ -167,10 +167,9 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
|
||||
int mask = _input->get_mouse_button_mask();
|
||||
int button_flag = 1 << (ev->get_button_index() - 1);
|
||||
if (ev->is_pressed()) {
|
||||
// since the event is consumed, focus manually
|
||||
if (!is_canvas_focused()) {
|
||||
focus_canvas();
|
||||
}
|
||||
// Since the event is consumed, focus manually. The containing iframe,
|
||||
// if used, may not have focus yet, so focus even if already focused.
|
||||
focus_canvas();
|
||||
mask |= button_flag;
|
||||
} else if (mask & button_flag) {
|
||||
mask &= ~button_flag;
|
||||
@@ -181,7 +180,8 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
|
||||
ev->set_button_mask(mask);
|
||||
|
||||
_input->parse_input_event(ev);
|
||||
// prevent selection dragging
|
||||
// Prevent multi-click text selection and wheel-click scrolling anchor.
|
||||
// Context menu is prevented through contextmenu event.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user