summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index a74bc35d4f..55cb5e4737 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -7,6 +7,7 @@
#include <LibGfx/Bitmap.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleComputer.h>
+#include <LibWeb/DOM/ARIARoleNames.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/HTML/EventNames.h>
@@ -197,4 +198,14 @@ bool HTMLImageElement::complete() const
return false;
}
+FlyString HTMLImageElement::default_role() const
+{
+ // https://www.w3.org/TR/html-aria/#el-img
+ // https://www.w3.org/TR/html-aria/#el-img-no-alt
+ if (alt().is_null() || !alt().is_empty())
+ return DOM::ARIARoleNames::img;
+ // https://www.w3.org/TR/html-aria/#el-img-empty-alt
+ return DOM::ARIARoleNames::presentation;
+}
+
}