After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 657613 - GtkEntry hides placeholder text when focused
GtkEntry hides placeholder text when focused
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Widget: GtkEntry
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-08-29 12:46 UTC by Allan Day
Modified: 2011-09-02 04:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Allan Day 2011-08-29 12:46:32 UTC
GtkEntry allows predefined text to be displayed in the field to give instructions to users. Search fields can include the text 'Search...' for example. This text is hidden when the text is focused.

Hiding the predefined text is undesirable in some situations, however. When a GtkEntry widget is focused by default, the user will never see the text it includes. We encountered this problem with GNOME Contacts - the contact name field is automatically focused when a new contact is created, yet users will never see the 'Enter contact name...' text that is supposed to be displayed there.
Comment 1 Matthias Clasen 2011-08-29 15:10:47 UTC
This is just one of the reasons why the entire placeholder text concept is problematic.
I only accepted this into GTK+ because people are used to this kind of crap from web uis
Comment 2 Emmanuele Bassi (:ebassi) 2011-08-30 07:33:03 UTC
I'd actually close this as NOTABUG: the Entry is behaving exactly as requested.

the aforementioned web UIs work because they don't assign focus to the entries.

the toolkit cannot really have API to say "please focus this widget but don't really because we want to do $FOO".

in this specific case, you can avoid setting the focus and attach a key-press-event signal handler and on the first key press redirect the focus to the entry and push the pressed key inside the widget - which is kind of what happens in the Shell (with the exception that the shell is just using a capture to re-assign the focus and doesn't need to push the key to the entry).
Comment 3 Matthias Clasen 2011-08-30 11:04:58 UTC
Lets keep this bug open for now, to maybe add a note about this to the ::placeholder-text docs
Comment 4 Matthias Clasen 2011-09-02 04:36:59 UTC
Added a note