-
Notifications
You must be signed in to change notification settings - Fork 6.1k
JDK-8274625: Search field placeholder behavior #5825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back hannesw! A progress list of the required criteria for merging this PR into |
|
The example documentation looks nice. I wonder if we could eventually use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use standard tools for standard tasks where possible. In this case using a "placeholder" instead of the custom "watermark" workaround fixes the problem, simplifies the code and looks better.
Update the copyright years before integrating.
| .setId(id) | ||
| .put(HtmlAttr.VALUE, value) | ||
| .put(HtmlAttr.DISABLED, "disabled"); | ||
| .put(HtmlAttr.DISABLED, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious: if such a call to put translates to a boolean HTML attribute, what call to put translates to an HTML attribute with an empty value?
| HtmlTree inputReset = HtmlTree.INPUT(reset, HtmlIds.RESET_BUTTON) | ||
| .put(HtmlAttr.VALUE, reset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a mere coincidence that "reset" is both an input type and the value of the "value" attribute:
<input type="reset" id="reset-button" disabled value="reset">
Why do we need this "value" attribute?
| doclet.Modifier_and_Type=Modifier and Type | ||
| doclet.Implementation=Implementation(s): | ||
| doclet.search=SEARCH: | ||
| doclet.search_placeholder=Search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later we should consider a better placeholder, such as an example input. We already have the adjacent "SEARCH" text label and the magnifying glass icon. Something tells me that the user has a pretty good idea what this field is for and that they don't need yet another "Search".
|
@hns This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 15 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
Mailing list message from Hannes Wallnoefer on javadoc-dev: Thanks for the review, Pavel.
Done.
I don?t think we need it, but I left it in as I?m not totally sure it is safe to remove and it isn?t shown anyway. By contrast the search input value caused some flickering during loading when the value was cleared by the search.js script and replaced by the placeholder.
Good question, I think there is currently no way to create an attribute with an empty string as value.
Yes, displaying example input may be a useful enhancement. |
|
/integrate |
|
Going to push as commit cdf8930.
Your commit was automatically rebased without conflicts. |
Please review a change to use the HTML
placeholderattribute in the javadoc search input instead of an actual input value. This revives the fix I originally created for JDK-8221366 but forwent back then because of insufficient support by the Microsoft IE and Edge browsers. MS Edge has since been updated and supports the placeholder attribute well now.Example pages generated with this change can be viewed here (top level pages only):
http://cr.openjdk.java.net/~hannesw/8274625/api.00/
I changed the color of the placeholder to a lighter grey than we used for our own solution because the placeholder attribute works in a slightly different way. While we removed the placeholder text when the user clicked on the input field, the standard placeholder is still visible right until the user starts entering text. Because of this, using a darker color for the placeholder is confusing because it can easily be mistaken for actual input. The lighter grey is also closer to the default value for most browsers and web frameworks such as bootstrap.
I also changed the HTML for the search input to not have an initial value of "search" which had then to be cleared by the search script. Furthermore, the
disabledattributes now come in HTML5 value-less boolean format, i.e.disabledinstead ofdisabled="disabled".In addition to most significant desktop browsers I tested the generated docs on various mobile browsers on Android and iOS devices.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5825/head:pull/5825$ git checkout pull/5825Update a local copy of the PR:
$ git checkout pull/5825$ git pull https://git.openjdk.java.net/jdk pull/5825/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5825View PR using the GUI difftool:
$ git pr show -t 5825Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5825.diff