GNOME Bugzilla – Bug 667502
Placeholder should be shown when the entry is focused
Last modified: 2018-05-02 15:17:50 UTC
GtkEntry documentation [1] has this note about placeholder: "Note that since the placeholder text gets removed when the entry received focus, using this feature is a bit problematic if the entry is given the initial focus in a window. Sometimes this can be worked around by delaying the initial focus setting until the first key event arrives." The reason why the placeholder isn't shown when the entry is focused is not given; the only reason given is why it should be shown. It sounds like this note is a pretty good reason to have the placeholder shown when the entry is focused. FWIW, this is what Mac OS and Windows seem to do. [1] http://developer.gnome.org/gtk3/3.2/GtkEntry.html#gtk-entry-set-placeholder-text
Created attachment 205443 [details] [review] show placeholder when focused
I think this request has been closed as notabug previously. The reason the placeholder text is removed is so that the user is able to tell that they can write in the textbox. I'm surprised that this is the OS X and Windows behaviour. The alternative to this bug is to either use a label outside the text box or not to focus the entry.
Also, an alternative to make sure the user doesn't think this is actually written, the placeholder text can have a right offset compared to where the caret is. Thus, the user will be less likely to think it's a written text. Maybe making the text in italic would help too?
Created attachment 231317 [details] Screenshot of Chrome's Placeholder Implementation
Created attachment 231318 [details] Screenshot of Android's Placeholder Implementation
Created attachment 231319 [details] Screenshot of iOS6's Placeholder Implementation
I believe the pervasiveness of this behavior across platforms demonstrates it is what users will expect. In addition, the fact that text entries that have the initial focus cannot reliably use placeholder text (and therefor must use UI-cluttering labels or focus hacks) demonstrates that this is an legitimate and important bug.
The entire thing is a misfeature; unfortunately, misfeatures get copied around just as much as features...
I reported this same issue in the past (bug 657613) and was persuaded that it was a bad idea. However, as time has gone on I have come back around to it. It is useful to be able to show a placeholder in a focused text entry: it's an opportunity to provide extra information in an elegant manner, particularly when an entry is focused by default. The key question, I suppose, is whether placeholder text could be confused for pre-filled text. I personally haven't experienced any confusion when encountering placeholder text on other platforms, and I haven't seen any evidence of confusion. Also, given that this behaviour is so widespread, I think we can assume that a fair proportion of users will be used to the convention.
*** Bug 752622 has been marked as a duplicate of this bug. ***
For added hilarity: * the W3C 'placeholder' spec was originally written in the same way GTK does — i.e. remove the placeholder text on focus * the W3C spec was discussed and subsequently changed after Apple moved their placeholder text behaviour to "keep even when focused", and modified Safari accordingly * WebKit and Firefox got changed to match with the spec * IE didn't, and Windows 7/8 specify in their HIGs that the placeholder text should go away on focus in * Various complaints required the addition of a configuration toggle to both Firefox and WebKit to select which behaviour was desirable Refs: * https://lists.webkit.org/pipermail/webkit-dev/2013-August/025305.html * https://bugzilla.mozilla.org/show_bug.cgi?id=673873#c74
(In reply to Emmanuele Bassi (:ebassi) from comment #11) > * Various complaints required the addition of a configuration toggle to > both Firefox and WebKit to select which behaviour was desirable See also https://bugs.webkit.org/show_bug.cgi?id=147104 which removes this configurability from WebKit.
We discussed this again in-person at the West Coast summit last year. I recall we settled that this should very likely be a GTK stylesheet concern; Adwaita could hide the placeholder text on focus, but other stylesheets (like elementary) could show the placeholder text on focus and ensure that it is styled sufficiently different from regular entry text. I also recall that doing so would require rendering the placeholder text differently (I don't remember the specifics), but it was generally accepted that it was a good idea. I wanted to check back in as we've had more bug reports filed against elementary OS and its apps requesting this behavior, and we'd love to implement it in our stylesheet. Example of a bug report: https://github.com/elementary/appcenter/issues/313
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/378.