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

Force focus into HTML5 input #273

Closed
wants to merge 3 commits into from

Conversation

jordanjones243
Copy link
Contributor

@jordanjones243 jordanjones243 commented Jan 24, 2025

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

Update component libraries to the latest versions and force focus into datepicker and combobox inputs to highlight text when tabbing into the components.

New Features:

  • Force focus into HTML5 input for datepicker and combobox components.

Enhancements:

  • Update dependency versions for various components and development tools.

@jordanjones243 jordanjones243 self-assigned this Jan 24, 2025
Copy link

sourcery-ai bot commented Jan 24, 2025

Reviewer's Guide by Sourcery

This pull request focuses on enhancing the focus behavior of the datepicker and combobox components. It ensures that when these components receive focus, the focus is correctly placed within the input field, and the text within the input is selected for better user experience. Additionally, it updates the versions of several development dependencies.

Sequence diagram for enhanced datepicker focus behavior

sequenceDiagram
    actor User
    participant DP as DatePicker
    participant Input as HTML5 Input

    User->>DP: Focus on component
    DP->>Input: Set focus
    alt Has existing value
        DP->>Input: Select text range (0 to value.length)
    end

    Note over DP,Input: New forceInputFocus() method
    Note over DP,Input: Ensures focus and text selection
Loading

Sequence diagram for enhanced combobox focus behavior

sequenceDiagram
    actor User
    participant CB as ComboBox
    participant Input as Input Element

    User->>CB: Focus on component
    CB->>CB: focus()
    alt Has input value
        CB->>Input: setSelectionRange(0, value.length)
    end

    Note over CB,Input: Enhanced focusin event handler
    Note over CB,Input: Automatically selects existing text
Loading

Class diagram showing updated AuroDatePicker component

classDiagram
    class AuroDatePicker {
        +focus()
        -forceInputFocus()
        -inputList[]
        -value
        -valueEnd
    }
    note for AuroDatePicker "Added forceInputFocus() method
Enhanced focus handling"
Loading

File-Level Changes

Change Details Files
Implement force focus on datepicker input
  • Added a new method forceInputFocus to handle focusing the input element.
  • Modified the focus event listener to call forceInputFocus to ensure the input is focused and text is selected.
components/datepicker/src/auro-datepicker.js
Implement focus and text selection on combobox input
  • Added a focusin event listener to the combobox to handle focusing the input element.
  • Modified the focusin event listener to select the text in the input field when the combobox receives focus.
components/combobox/src/auro-combobox.js
Update development dependencies
  • Updated @commitlint/cli from 19.6.1 to 19.7.1.
  • Updated @commitlint/config-conventional from 19.6.0 to 19.7.1.
  • Updated eslint from 9.18.0 to 9.19.0.
  • Updated eslint-plugin-jsdoc from 50.6.1 to 50.6.3.
  • Updated postcss from 8.5.0 to 8.5.1.
  • Updated sass from 1.83.1 to 1.83.4.
  • Updated stylelint from 16.13.1 to 16.14.1.
  • Updated stylelint-scss from 6.10.0 to 6.11.0.
  • Updated turbo from 2.3.3 to 2.4.0.
package.json
package-lock.json
Update component bundle versions in README files
  • Updated the component bundle versions in the README files to 2.0.0-beta.31.
components/combobox/README.md
components/datepicker/README.md
components/select/README.md
components/checkbox/README.md
components/counter/README.md
components/dropdown/README.md
components/form/README.md
components/input/README.md
components/menu/README.md
components/radio/README.md

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@jordanjones243 jordanjones243 force-pushed the jjones/datepickerImprovements branch from 667acf4 to 80d856e Compare February 3, 2025 21:46
@jordanjones243 jordanjones243 marked this pull request as ready for review February 3, 2025 21:46
@jordanjones243 jordanjones243 requested a review from a team as a code owner February 3, 2025 21:46
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jordanjones243 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jordanjones243 jordanjones243 force-pushed the jjones/datepickerImprovements branch from 80d856e to 78f6908 Compare February 3, 2025 22:10
* @private
* @returns {void}
*/
forceInputFocus() {
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to experiment with if enabling "delegate focus" helps at all. But otherwise looks good to me.

@jordanjones243
Copy link
Contributor Author

Work done in this PR fixes handling of forcing focus into input and all input components now behave the same way:

@jordanjones243 jordanjones243 deleted the jjones/datepickerImprovements branch February 5, 2025 23:02
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