diff --git a/accessible/tests/browser/windows/uia/browser_textPatterns.js b/accessible/tests/browser/windows/uia/browser_textPatterns.js index d1936bd261eb..3a8193ae6d60 100644 --- a/accessible/tests/browser/windows/uia/browser_textPatterns.js +++ b/accessible/tests/browser/windows/uia/browser_textPatterns.js @@ -538,6 +538,7 @@ addUiaTask(
a bcd ef
a bcd ef
a bcd ef
+
a bcd ef
a bcd ef
a bcd ef
@@ -792,6 +793,19 @@ addUiaTask( "IsReadOnly correct" ); + // Verify that text inputs are not read-only by default. + await runPython(` + global range + textInputAcc = findUiaByDomId(doc, "text-input") + range = docText.RangeFromChild(textInputAcc) + `); + info("checking IsReadOnly"); + is( + await runPython(`range.GetAttributeValue(UIA_IsReadOnlyAttributeId)`), + false, + "IsReadOnly correct for text input" + ); + // ================== UIA_AnnotationTypesAttributeId - AnnotationType_SpellingError ================== await runPython(` global range diff --git a/accessible/windows/uia/UiaTextRange.cpp b/accessible/windows/uia/UiaTextRange.cpp index e65eac37801b..0c0e365ea1a1 100644 --- a/accessible/windows/uia/UiaTextRange.cpp +++ b/accessible/windows/uia/UiaTextRange.cpp @@ -1307,15 +1307,20 @@ struct AttributeTraits { if (!aPoint.mAcc) { return {}; } - // Check the parent of the leaf, since the leaf itself will never be - // editable, but the parent may. Check for both text fields and hypertexts, - // since we might have something like or a contenteditable . Accessible* acc = aPoint.mAcc; - Accessible* parent = acc->Parent(); - if (parent && parent->IsHyperText()) { - acc = parent; - } else { - return Some(true); + // If the TextLeafPoint we're dealing with is itself a hypertext, don't + // bother checking its parent since this is the Accessible we care about. + if (!acc->IsHyperText()) { + // Check the parent of the leaf, since the leaf itself will never be + // editable, but the parent may. Check for both text fields and + // hypertexts, since we might have something like or a + // contenteditable . + Accessible* parent = acc->Parent(); + if (parent && parent->IsHyperText()) { + acc = parent; + } else { + return Some(true); + } } const uint64_t state = acc->State(); if (state & states::READONLY) {