mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-19 17:27:51 +03:00
LibWeb: Allow HTMLElement with contenteditable=true to be focusable
This commit is contained in:
parent
bcb68eb632
commit
05d5e11966
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/05d5e11966 Pull-request: https://github.com/SerenityOS/serenity/pull/23320
1
Tests/LibWeb/Text/expected/focus-contenteditable.txt
Normal file
1
Tests/LibWeb/Text/expected/focus-contenteditable.txt
Normal file
@ -0,0 +1 @@
|
||||
contenteditable is focused
|
18
Tests/LibWeb/Text/input/focus-contenteditable.html
Normal file
18
Tests/LibWeb/Text/input/focus-contenteditable.html
Normal file
@ -0,0 +1,18 @@
|
||||
<script src="include.js"></script>
|
||||
<style>
|
||||
#editable {
|
||||
border: 1px solid black;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<div id="editable" contenteditable="true"></div>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
document.getElementById("editable").addEventListener("focus", () => {
|
||||
println("contenteditable is focused");
|
||||
done();
|
||||
});
|
||||
internals.click(50, 50);
|
||||
});
|
||||
</script>
|
@ -93,6 +93,11 @@ bool HTMLElement::is_editable() const
|
||||
}
|
||||
}
|
||||
|
||||
bool HTMLElement::is_focusable() const
|
||||
{
|
||||
return m_content_editable_state == ContentEditableState::True;
|
||||
}
|
||||
|
||||
StringView HTMLElement::content_editable() const
|
||||
{
|
||||
switch (m_content_editable_state) {
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
void set_dir(String const&);
|
||||
|
||||
virtual bool is_editable() const final;
|
||||
virtual bool is_focusable() const override;
|
||||
StringView content_editable() const;
|
||||
WebIDL::ExceptionOr<void> set_content_editable(StringView);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user