diff --git a/html/dom/elements/global-attributes/dir-auto-form-associated.window.js b/html/dom/elements/global-attributes/dir-auto-form-associated.window.js
new file mode 100644
index 00000000000000..c426417bcfaef8
--- /dev/null
+++ b/html/dom/elements/global-attributes/dir-auto-form-associated.window.js
@@ -0,0 +1,60 @@
+// Keep this synchronized with
+// html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html
+[
+ "hidden",
+ "text",
+ "search",
+ "tel",
+ "url",
+ "email",
+ "password",
+ "submit",
+ "reset",
+ "button"
+].forEach(type => {
+ test(t => {
+ const input = document.createElement("input");
+ t.add_cleanup(() => input.remove());
+ input.type = type;
+ assert_equals(input.type, type);
+ input.dir = "auto";
+ input.value = "\u05D0"; // The Hebrew letter Alef (strongly RTL)
+ document.body.append(input);
+ assert_true(input.matches(":dir(rtl)"));
+ }, ` directionality`);
+});
+
+[
+ "date",
+ "month",
+ "week",
+ "time",
+ "datetime-local",
+ "number",
+ "range",
+ "color",
+ "checkbox",
+ "radio",
+ // "file" // value setter throws
+ "image"
+].forEach(type => {
+ test(t => {
+ const input = document.createElement("input");
+ t.add_cleanup(() => input.remove());
+ input.type = type;
+ assert_equals(input.type, type);
+ input.dir = "auto";
+ input.value = "\u05D0"; // The Hebrew letter Alef (strongly RTL)
+ document.body.append(input);
+ assert_true(input.matches(":dir(ltr)"));
+ }, ` directionality`);
+});
+
+test(t => {
+ const input = document.createElement("textarea");
+ t.add_cleanup(() => input.remove());
+ input.dir = "auto";
+ input.value = "\u05D0"; // The Hebrew letter Alef (strongly RTL)
+ document.body.append(input);
+ assert_true(input.matches(":dir(rtl)"));
+}, `