mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Do not delete empty range in EventHandler::handle_keydown()
Fixes a crash that occurs when inputting into an empty contenteditable element (`EditEventHandler::handle_delete()` assumes the cursor position's node is always `DOM::Text`, which is not the case for an empty `contenteditable`).
This commit is contained in:
parent
1528e9109c
commit
6b17ab77f3
Notes:
sideshowbarker
2024-07-17 00:49:59 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 6b17ab77f3
Pull-request: https://github.com/SerenityOS/serenity/pull/23326
Reviewed-by: https://github.com/awesomekling
1 changed files with 1 additions and 1 deletions
|
@ -757,7 +757,7 @@ bool EventHandler::handle_keydown(KeyCode key, u32 modifiers, u32 code_point)
|
|||
|
||||
if (auto selection = document->get_selection()) {
|
||||
auto range = selection->range();
|
||||
if (range && range->start_container()->is_editable()) {
|
||||
if (range && !range->collapsed() && range->start_container()->is_editable()) {
|
||||
selection->remove_all_ranges();
|
||||
|
||||
// FIXME: This doesn't work for some reason?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue