diff --git a/Tests/LibWeb/Text/expected/focus-contenteditable.txt b/Tests/LibWeb/Text/expected/focus-contenteditable.txt new file mode 100644 index 0000000000..95cdf1d16e --- /dev/null +++ b/Tests/LibWeb/Text/expected/focus-contenteditable.txt @@ -0,0 +1 @@ + contenteditable is focused diff --git a/Tests/LibWeb/Text/input/focus-contenteditable.html b/Tests/LibWeb/Text/input/focus-contenteditable.html new file mode 100644 index 0000000000..171c39eee6 --- /dev/null +++ b/Tests/LibWeb/Text/input/focus-contenteditable.html @@ -0,0 +1,18 @@ + + +
+ diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index c99ee7c0f4..f958711ed0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -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) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index abe0391a3a..1c23657a33 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -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