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

Address input bugs #122

Open
wants to merge 5 commits into
base: beta
Choose a base branch
from
Open

Address input bugs #122

wants to merge 5 commits into from

Conversation

jordanjones243
Copy link
Contributor

@jordanjones243 jordanjones243 commented Dec 16, 2024

Alaska Airlines Pull Request

Before Submitting this pull request:

  • Link all tickets in this repository related to this PR in the Development section
    note: all pull requests require at least one linked ticket
  • If this PR is Ready For Review, all ticket's linked under Development must have their status changed to Ready For Review as well

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I have performed a self-review of my own update.

Summary by Sourcery

Fix input type inconsistencies by changing 'numeric' to 'number' in both code and documentation, enhancing clarity and compliance with HTML standards.

Bug Fixes:

  • Correct the input type from 'numeric' to 'number' for attributes 'max' and 'min' in the input component documentation and code.

Enhancements:

  • Update the input mode from 'numeric' to 'number' in the base input component to align with HTML standards.

Documentation:

  • Revise documentation to reflect the change from 'numeric' to 'number' for input types, ensuring consistency across examples and descriptions.

@jordanjones243 jordanjones243 self-assigned this Dec 16, 2024
@jordanjones243 jordanjones243 changed the base branch from main to beta December 16, 2024 21:46
Copy link

sourcery-ai bot commented Dec 16, 2024

Reviewer's Guide by Sourcery

This PR addresses input validation and terminology consistency issues. The main changes include updating the input validation logic to properly handle programmatic resets and replacing deprecated 'numeric' type references with the standard 'number' type. The implementation also includes UI improvements for bordered inputs and label positioning.

Class diagram for BaseInput and AuroFormValidation changes

classDiagram
    class BaseInput {
        - String max
        - String min
        - String inputMode
        + handleInput()
    }
    class AuroFormValidation {
        + validateType(elem)
        + validateAttributes(elem)
        + handleInputReset(elem)
    }
    note for BaseInput "Changed inputMode from 'numeric' to 'number'"
    note for AuroFormValidation "Added logic to reset validity state on programmatic reset"
Loading

File-Level Changes

Change Details Files
Improved input validation handling for programmatic resets
  • Added condition to reset validity state when input value is programmatically set to undefined
  • Modified validation checks to be independent rather than chained with else-if statements
  • Removed deprecated 'numeric' type check in validation logic
packages/form-validation/src/validation.js
Updated terminology from 'numeric' to 'number' throughout the codebase
  • Updated attribute documentation to use 'number' instead of 'numeric'
  • Renamed example files from 'maxNumeric' and 'minNumeric' to 'maxNumber' and 'minNumber'
  • Updated inputMode assignments to use 'number' instead of 'numeric'
components/input/demo/api.md
components/input/docs/partials/api.md
components/input/docs/api.md
components/input/src/base-input.js
Enhanced input styling and layout
  • Added specific padding for bordered inputs
  • Updated label positioning with standardized spacing variables
  • Modified active label positioning to use consistent spacing
components/input/src/styles/input.scss
components/input/src/styles/label.scss

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sun-mota sun-mota left a comment

Choose a reason for hiding this comment

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

also, the disabled state colors are off from https://www.figma.com/design/VpUz89Ov6ImBpY5YvzYbZW/Auro-toolkit?node-id=3264-27509&m=dev (not sure if this is the latest design)

@@ -144,6 +148,9 @@ export default class AuroFormValidation {
this.validateType(elem);
this.validateAttributes(elem);
}
} else if (elem.value === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. validationShouldRun is false, but why do we touch validity?
  2. maybe validationShouldRun should be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are touching validity to reset it. In the case of this fix, users expect that validity state to reset when setting the element to value=undefined. Since validationShouldRun is false, it skips the validation logic and resets the validity state.

Copy link
Contributor

Choose a reason for hiding this comment

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

should we not reset the validity always at the beginning of the validate function? as elem.value is not only case that we want to reset.

@jordanjones243
Copy link
Contributor Author

jordanjones243 commented Dec 18, 2024

also, the disabled state colors are off from https://www.figma.com/design/VpUz89Ov6ImBpY5YvzYbZW/Auro-toolkit?node-id=3264-27509&m=dev (not sure if this is the latest design)

Per this design spec, the disabled colors are correct:
https://www.figma.com/design/tSkHw1uJfDHy0Ml0aDp7Io/branch/SWOHKZpz2K78PPL43uvp5z/Auro-color-palette-(Variables)?node-id=4224-10615&m=dev

The design spec linked in the previous comment is outdated.

packages/form-validation/src/validation.js Outdated Show resolved Hide resolved
packages/form-validation/src/validation.js Outdated Show resolved Hide resolved
@jordanjones243 jordanjones243 force-pushed the jjones/fixInputBugs branch 3 times, most recently from 32a7237 to ab0c7a0 Compare December 18, 2024 22:46
Copy link
Contributor

@chrisfalaska chrisfalaska left a comment

Choose a reason for hiding this comment

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

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants