diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
index a54ad5298d9..67218848d61 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -119,8 +119,10 @@ void HTMLAnchorElement::activation_behavior(Web::DOM::Event const& event)
// 4. Let userInvolvement be event's user navigation involvement.
auto user_involvement = user_navigation_involvement(event);
- // FIXME: 5. If the user has expressed a preference to download the hyperlink, then set userInvolvement to "browser UI".
+ // 5. If the user has expressed a preference to download the hyperlink, then set userInvolvement to "browser UI".
// NOTE: That is, if the user has expressed a specific preference for downloading, this no longer counts as merely "activation".
+ if (has_download_preference())
+ user_involvement = UserNavigationInvolvement::BrowserUI;
// FIXME: 6. If element has a download attribute, or if the user has expressed a preference to download the
// hyperlink, then download the hyperlink created by element with hyperlinkSuffix set to hyperlinkSuffix and
@@ -130,6 +132,11 @@ void HTMLAnchorElement::activation_behavior(Web::DOM::Event const& event)
follow_the_hyperlink(hyperlink_suffix, user_involvement);
}
+bool HTMLAnchorElement::has_download_preference() const
+{
+ return has_attribute(HTML::AttributeNames::download);
+}
+
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
i32 HTMLAnchorElement::default_tab_index_value() const
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index c2a86d8505d..1014ea96776 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -43,6 +43,7 @@ private:
virtual bool has_activation_behavior() const override;
virtual void activation_behavior(Web::DOM::Event const&) override;
+ virtual bool has_download_preference() const;
// ^DOM::Element
virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value) override;