8326694: Defer setting of autocapitalize attribute

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2024-02-28 18:13:16 +00:00
parent 38ad514589
commit be2b92bd8b
9 changed files with 9 additions and 10 deletions

View File

@ -480,8 +480,7 @@ public class Navigation {
var inputText = HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlIds.SEARCH_INPUT)
.put(HtmlAttr.PLACEHOLDER, resources.getText("doclet.search_placeholder"))
.put(HtmlAttr.ARIA_LABEL, resources.getText("doclet.search_in_documentation"))
.put(HtmlAttr.AUTOCOMPLETE, "off")
.put(HtmlAttr.AUTOCAPITALIZE, "off");
.put(HtmlAttr.AUTOCOMPLETE, "off");
var inputReset = HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlIds.RESET_SEARCH)
.put(HtmlAttr.VALUE, resources.getText("doclet.search_reset"));
var searchDiv = HtmlTree.DIV(HtmlStyle.navListSearch)

View File

@ -84,8 +84,7 @@ public class SearchWriter extends HtmlDocletWriter {
.add(HtmlTree.DIV(HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlId.of("page-search-input"))
.put(HtmlAttr.PLACEHOLDER, resources.getText("doclet.search_placeholder"))
.put(HtmlAttr.ARIA_LABEL, resources.getText("doclet.search_in_documentation"))
.put(HtmlAttr.AUTOCOMPLETE, "off")
.put(HtmlAttr.AUTOCAPITALIZE, "off"))
.put(HtmlAttr.AUTOCOMPLETE, "off"))
.add(HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlId.of("page-search-reset"))
.put(HtmlAttr.VALUE, resources.getText("doclet.search_reset"))
.put(HtmlAttr.STYLE, "margin: 6px;"))

View File

@ -95,8 +95,7 @@ public class TableOfContents {
.add(HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlStyle.filterInput)
.put(HtmlAttr.PLACEHOLDER, writer.resources.getText("doclet.filter_label"))
.put(HtmlAttr.ARIA_LABEL, writer.resources.getText("doclet.filter_table_of_contents"))
.put(HtmlAttr.AUTOCOMPLETE, "off")
.put(HtmlAttr.AUTOCAPITALIZE, "off"))
.put(HtmlAttr.AUTOCOMPLETE, "off"))
.add(HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlStyle.resetFilter)
.put(HtmlAttr.VALUE, writer.resources.getText("doclet.filter_reset")));
}

View File

@ -39,7 +39,6 @@ public enum HtmlAttr {
ARIA_ORIENTATION("aria-orientation"),
ARIA_SELECTED("aria-selected"),
AUTOCOMPLETE,
AUTOCAPITALIZE,
CHECKED,
CLASS,
CLEAR,

View File

@ -246,6 +246,7 @@ document.addEventListener("DOMContentLoaded", function(e) {
}
document.querySelectorAll("input.filter-input").forEach(function(input) {
input.removeAttribute("disabled");
input.setAttribute("autocapitalize", "off");
input.value = "";
input.addEventListener("input", function(e) {
const pattern = input.value ? input.value.trim()

View File

@ -244,6 +244,7 @@ $(window).on("load", function() {
setSearchUrl();
});
input.prop("disabled", false);
input.attr("autocapitalize", "off");
reset.prop("disabled", false);
var urlParams = new URLSearchParams(window.location.search);
@ -263,4 +264,4 @@ $(window).on("load", function() {
notify.html(messages.enterTerm);
}
input.select().focus();
});
});

View File

@ -426,6 +426,7 @@ $(function() {
});
search.val('');
search.prop("disabled", false);
search.attr("autocapitalize", "off");
reset.prop("disabled", false);
reset.click(function() {
search.val('').focus();

View File

@ -434,7 +434,7 @@ public class TestSearch extends JavadocTester {
"""
<div class="nav-list-search">
<input type="text" id="search-input" disabled placeholder="Search" aria-label="S\
earch in documentation" autocomplete="off" autocapitalize="off">
earch in documentation" autocomplete="off">
<input type="reset" id="reset-search" disabled value="Reset">
</div>""");
}

View File

@ -134,7 +134,7 @@ public class TestSpecTag extends JavadocTester {
<ol class="sub-nav-list"></ol>
<div class="nav-list-search">
<input type="text" id="search-input" disabled placeholder="Search" aria-label="S\
earch in documentation" autocomplete="off" autocapitalize="off">
earch in documentation" autocomplete="off">
<input type="reset" id="reset-search" disabled value="Reset">
</div>
</div>