Improve machine name AJAX focus handling integration

Created on 30 October 2023, about 1 year ago
Updated 10 November 2023, about 1 year ago

Problem/Motivation

The machine name field doesn't integrate well with the AJAX system. On the list_string item, after entering an item, the first tab takes the user to Edit link for the machine name, but then focus immediately goes back to the Name field. The focus should retain on the "Edit" link.

Similar issue happens after the machine name field has been exposed, and user tabs out from the field. Focus is now lost, even though it should be retained on the element where it moved.

Proposed resolution

Add integration tests for this use case and fix the integration.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.2

Component
Ajax 

Last updated 2 days ago

Created by

🇫🇮Finland lauriii Finland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lauriii
  • @lauriii opened merge request.
  • Status changed to Needs review about 1 year ago
  • 🇫🇮Finland lauriii Finland

    Posted MR which should fix the bug. I spend some time trying to write tests for this but it seemed tricky to reproduce this in tests because it requires triggering the tab key press and change event at the same time.

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

    Did manual testing of this issue.

    Adding a List(text) field to a content type and purely using my keyboard, saw the issue you're talking about where after I input a label and tab focus comes back. The MR corrects this issue.

    As far as a test goes. Could it be as simple as press tab key and just check where the focus is? For me the ajax didn't seem to run till after I pressed tab so doesn't that mean the event triggers automatically with the key?

  • Status changed to Needs review about 1 year ago
  • 🇫🇮Finland lauriii Finland

    This is really tricky to test because I couldn't figure out a way to change the field value using Mink without immediately triggering the change event. I tried some approaches with JavaScript but couldn't get the right sequence of events triggered. I think we should consider committing this without tests given that this is pretty challenging to test using our testing system.

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Thanks for taking a look! In that case RTBC+1

    • longwave committed 27d9ff83 on 10.2.x
      Issue #3397742 by lauriii, smustgrave: Improve machine name AJAX focus...
    • longwave committed 874adf17 on 11.x
      Issue #3397742 by lauriii, smustgrave: Improve machine name AJAX focus...
  • 🇬🇧United Kingdom longwave UK

    Confirmed the bug and fix with similar manual testing. Agree that test coverage is trickier than it's worth to write.

    Committed and pushed 874adf1734 to 11.x and 27d9ff8359 to 10.2.x. Thanks!

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024