Bug 189463 - [GTK] Mark text in javascript alerts as selectable
Summary: [GTK] Mark text in javascript alerts as selectable
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-09 04:03 PDT by Benjamin Berg
Modified: 2018-09-13 08:00 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Berg 2018-09-09 04:03:12 PDT
Alerts from Javascript are currently not selectable, making it impossible to copy the text from them. It may be useful to copy text from such alerts for various reasons (e.g. passing on to support, copying into a translation engine) and doing so should be easy.

Michael said that this would require changes in WebKitScriptDialogGtk.cpp and WebKitWebViewBase.cpp (https://gitlab.gnome.org/GNOME/epiphany/issues/528). I expect it should be as simple as setting the "selectable" property of GtkLabel.
Comment 1 Michael Catanzaro 2018-09-11 22:39:07 PDT
(In reply to Benjamin Berg from comment #0)
> I expect it should be
> as simple as setting the "selectable" property of GtkLabel.

I can confirm this fixes the issue.

But I can reproduce the same issue in GNOME Chess. Move any chess piece, then press the open button and try to select the text in the "Save this game before loading another one?" message box that pops up. You can't. It's a general issue with GtkMessageDialog. I found this code in gtk_message_dialog_init():

  settings = gtk_widget_get_settings (GTK_WIDGET (dialog));
  g_object_get (settings, "gtk-keynav-use-caret", &use_caret, NULL);
  gtk_label_set_selectable (GTK_LABEL (priv->label), use_caret);
  gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);

So it seems intentional. CC Benjamin Otte. Should we change that? If so, this will need to pingpong back to gitlab.gnome.org.
Comment 2 Michael Catanzaro 2018-09-11 22:42:14 PDT
It was changed in https://gitlab.gnome.org/GNOME/gtk/commit/92662828ba43c2d3507bb8f4dc253f2f429e91ae

"""
We used to always make the labels in message dialogs selectable,
which is a bit problematic wrt. to keynav - the label can
unexpectedly 'turn blue', which irritates some people.

With the new gtk-keynav-use-caret setting, we can now only
make the labels selectable when it is required for accessibilty
reasons.
"""

So I am going to say this is WONTFIX on WebKit's end. Please talk to Matthias and the other GTK+ developers about it.
Comment 3 Michael Catanzaro 2018-09-11 22:43:51 PDT
Here is an existing issue report:

https://gitlab.gnome.org/GNOME/gtk/issues/735

Discussion should continue there.
Comment 4 Michael Catanzaro 2018-09-13 08:00:48 PDT
Reopening since we're going to stop using GtkMessageDialog in bug #189545