Problem/Motivation

Reported by eagle-eyed 🦅 @xjm at #2896143-11: Unintentional animation of the body while Settings Tray is installed:

The cursor when hovering over text fields for (e.g.) the site name is a pointing hand (like for a link) rather than a text cursor.

See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

Proposed resolution

  1. When hovering over links (and buttons and other elements supporting interaction): make the cursor behave as if there's nothing to click (because there really isn't)
  2. When using the form in the Settings Tray: make the cursor behave as you'd expect for the given form element, rather than always using the pointer cursor

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new817 bytes

This actually has the necessary CSS already:

#main-canvas.js-outside-in-edit-mode a,
#main-canvas.js-outside-in-edit-mode input {
  pointer-events: none;
}
#main-canvas.js-outside-in-edit-mode .contextual-links a {
  pointer-events: inherit;
}

… but that was broken by #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas, which updated the attributes used in outside-in-page-wrapper.html.twig without updating the CSS selectors too.

See https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events.

Simply fixing the CSS selectors is enough.

tedbow’s picture

Status: Needs review » Needs work
+++ b/core/modules/outside_in/css/outside_in.module.css
@@ -14,11 +14,11 @@
-#main-canvas.js-outside-in-edit-mode a,
-#main-canvas.js-outside-in-edit-mode input {
+[data-off-canvas-main-canvas].js-outside-in-edit-mode a,
+[data-off-canvas-main-canvas].js-outside-in-edit-mode input {

Why use a data attribute here instead of .dialog-off-canvas__main-canvas. This class is used throughout the CSS in this module

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new823 bytes

Done.

But that's exactly what I'm going to file another issue for: the presence of both classes and data- attributes. Out of scope here though.

The last submitted patch, 2: 2897320-2.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 4: 2897320-4.patch, failed testing. View results

andrewmacpherson’s picture

This patch works, on manual mouse testing. Seems like a simple regression, and we're just restoring behaviour that was already decided.

It also stops a caret-insertion pointer when hovering over text inputs (e.g. the text input in the search block, present in Bartik from Standard install profile).

There are some other places (buttons) where we are using cursor: pointer inappropriately, but I'll file a separate issue for that, since it doesn't involve outside_in module, and doesn't involve

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new653 bytes
new1.34 KB

We had to add this test module outside_in_test_css because of known bug with PointerEvents and testbots. Had to update that module too.

See #2782915-39: Standardize the behavior of links when Outside In editing mode is enabled.

It gets the test to pass and can't really test for mouse pointers anyways.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

#8++ — I'd never have figured that out!

To RTBC per #7.

xjm’s picture

Status: Reviewed & tested by the community » Needs review

This patch doesn't resolve the issue for me. I still get the "hand" cursor instead of the text cursor when hovering over (e.g.) the "Site name" editing field in the sidebar tray.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

#10: Are you sure you disabled CSS aggregates or forced them to be rebuilt? Are you sure you cleared your browser cache?

Both I and #7 did manual testing and found it to work.

xjm’s picture

Status: Reviewed & tested by the community » Needs review

Yes, of course I did. Installed a fresh site with the patch, cleared browser cache, Incognito mode, etc.

xjm’s picture

I would take a screenshot to prove it, but screenshots exclude your cursor.

star-szr’s picture

Status: Needs review » Needs work

I tested this and was only focusing on the main canvas (and was about to commit), but what @xjm is talking about is with the off canvas tray. Crossed wires somewhere along the way, although both are valid to address, and maybe we can address both in this issue.

#10:

"Site name" editing field in the sidebar tray.

Which I can confirm hasn't changed with this patch. The site name and slogan fields in the sidebar tray show a pointer cursor where they should show a text cursor. Only the label element should show a pointer. There is some CSS that applies a cursor: pointer to a ton of form elements in the off-canvas form which doesn't seem right.

(Edited to clarify and correct the last sentence)

wim leers’s picture

I tested this and was only focusing on the main canvas (and was about to commit)

That's also how I understood it, tested it, and patched it. And how everybody else here has been reviewing/testing it AFAICT.

but what @xjm is talking about is with the off canvas tray

AHHHHHHHH 💡

wim leers’s picture

Title: Cursor is using the "pointer" cursor when hovering over links while Edit mode is enabled, indicating ability to interact — should instead use the "default" cursor » Settings Tray causes the "pointer" cursor to be used both when hovering over inaccessible links (should use "default" cursor) and when in input[type=text] (should use "text" cursor)
Issue summary: View changes

Updated title & IS for accuracy.

@Cottser++
@Cottser++
@Cottser++

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new994 bytes
new2.5 KB
tedbow’s picture

@Cottser thanks for catching that.

Checking Pointers manually

Without patch

In main canvas

  1. Disabled links in edit mode:hand -wrong
  2. Disabled form submit: hand - wrong
  3. Textfield: cursor - wrong
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: hand - wrong

With patch

In main canvas

  1. Disabled links in edit mode: standard pointer
  2. Disabled form submit: standard pointer
  3. Textfield: standard pointer
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: cursor
wim leers’s picture

Status: Needs review » Reviewed & tested by the community

Based on #18's manual testing.

andrewmacpherson’s picture

Wow, what a mix up! I had the same misunderstanding about the issue.

There are some other incorrect mouse cursors, such as:

4. Contextual links button [...] : hand

Buttons should not have cursor: pointer. (The CSS recs say the hand pointer for links only, as do UI guidelines form Microsoft and Apple. The MDN wiki is at odds with these.)

There's some other downright strange stuff too, like the dialog title having an editing caret on hover.

However these issues occur regardless of whether outside_in module is enabled, so I'll file follow-up issues about them.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: 2897320-17.patch, failed testing. View results

andrewmacpherson’s picture

Issue tags: +Needs re-roll
tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB

Checking Pointers manually same checks as #18

Without patch

In main canvas

  1. Disabled links in edit mode:hand -wrong
  2. Disabled form submit: hand - wrong
  3. Textfield: cursor - wrong
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: cursor

So only the "main canvas" is wrong now without the patch. #2826722: Add a 'fence' around settings tray with aggressive CSS reset. fixed the off-canvas issues

With patch

In main canvas

  1. Disabled links in edit mode: standard pointer
  2. Disabled form submit: standard pointer
  3. Textfield: standard pointer
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: cursor

so now the only changes needed are to replace the outdated #main-canvas to .dialog-off-canvas__main-canvas

I have checked and these are also the only occurrence of #main-canvas in the module.

tedbow’s picture

Issue tags: -Needs re-roll +Needs manual testing

Adding "Needs manual testing" because the reviewer should probably do this.

dyannenova’s picture

Status: Needs review » Reviewed & tested by the community

I've manually tested this and patch #23 is working correctly.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Needs work

I still get the hand on the text fields in the sidebar instead of the text cursor, with this patch in a fresh install on simplytestme.

Steps to reproduce:

  1. Install Standard.
  2. Enable Settings Tray.
  3. Enable Edit mode.
  4. Click on the site title.
  5. Mouse over the sidebar text field containing the site name. You get a big fat hand, like you could manipulate the field, instead of a text cursor.

I even tested it in Safari to prove it wasn't any caching anything.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

star-szr’s picture

Latest patch looks like it's missing the changes from outside_in.theme.css and outside_in.form.css. (See #17)

wim leers’s picture

Yup, #23 is an incomplete rebase of #17. Probably due to not git adding after resolving conflicts.

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB
+++ b/core/modules/outside_in/css/outside_in.theme.css
@@ -205,7 +205,6 @@
-  cursor: pointer;

This one apparently already happened in #2826722: Add a 'fence' around settings tray with aggressive CSS reset..

Apparently #2826722: Add a 'fence' around settings tray with aggressive CSS reset. added

cursor:
 pointer

9 times, and removed it 2 times.

Which means this patch needs to be thoroughly re-tested, since things have changed quite a bit.

tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Checking Pointers manually same checks as #18

Without patch

In main canvas

  1. Disabled links in edit mode:hand -wrong
  2. Disabled form submit: hand - wrong
  3. Textfield: cursor - wrong
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: cursor

So only the "main canvas" is wrong now without the patch. #2826722: Add a 'fence' around settings tray with aggressive CSS reset. fixed the off-canvas issues

With patch

In main canvas

  1. Disabled links in edit mode: standard pointer
  2. Disabled form submit: standard pointer
  3. Textfield: standard pointer
  4. Contextual links button and links: hand

In off-canvas tray

  1. Links: hand
  2. form submit: hand
  3. Textfield: cursor

Manual tests show the same as #23 which is correct

  • Cottser committed 8742371 on 8.5.x
    Issue #2897320 by Wim Leers, tedbow, xjm, andrewmacpherson, Cottser,...

  • Cottser committed 084780a on 8.4.x
    Issue #2897320 by Wim Leers, tedbow, xjm, andrewmacpherson, Cottser,...
star-szr’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs manual testing

It's strange that the labels with a "for" attribute are not cursor: pointer but that's out of scope for this issue.

Committed and pushed 8742371f7c to 8.5.x and 084780a642 to 8.4.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tedbow’s picture

Component: outside_in.module » settings_tray.module

Changing to new settings_tray.module component. @drpal thanks for script help! :)