Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix textbox autofocus triggering invalid message #256

Merged

Conversation

bjester
Copy link
Member

@bjester bjester commented Aug 31, 2021

Description

Test failures in a Studio PR indicated a regression in KTextbox. Looking at the code, I surmised the issue resulted from using autofocus along with how the invalid state is triggered.

Before/after screenshots

Initial state before Initial state after Error state after
Screenshot from 2021-08-31 13-12-09 Screenshot from 2021-08-31 14-03-44 Screenshot from 2021-08-31 14-02-56

Steps to test

  1. Link KDS into Studio-- you may have to temporarily add a core-js dependency to KDS
  2. Open a channel for editing
  3. Make some edits to enable publishing
  4. Click publish to open publish modal
  5. Observe validation text is not showing initially
  6. Blur textbox, and refocus
  7. Observe validation text is shown

(optional) Implementation notes

At a high level, how did you implement this?

If autofocus is enabled, skip first focus event before assigning changedOrFocused, which influences the computed property showInvalidMessage

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change has been added to the changelog

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

Post-merge updates and tracking

  • Learning Platform update PR is submitted
  • Learning Platform update PR is merged
  • Studio update PR is submitted
  • Studio update PR is merged
  • Data Portal update PR is submitted
  • Data Portal update PR is merged

Comments

Copy link
Contributor

@indirectlylit indirectlylit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I'll merge this is to help with the upcoming KDS upgrades and we can always follow up later if necessary.

There are aspects of the conditional logic in this component – predating this PR – that make me a bit uncomfortable and I worry are hiding subtle bugs. But that's for another day.

@indirectlylit indirectlylit merged commit 5e008df into learningequality:main Sep 2, 2021
indirectlylit added a commit that referenced this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants