Skip to content
New issue

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

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

Already on GitHub? # to your account

docs: ensure the date time picker remains visible even when the year-month selection button loses focus #973

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

cheton
Copy link
Member

@cheton cheton commented Feb 12, 2025

PR Type

Bug fix, Documentation


Description

  • Ensures the date-time picker remains visible when year-month selection loses focus.

  • Updates the closeOnBlur property in the range picker example.


Changes walkthrough 📝

Relevant files
Bug fix
range-picker.js
Update `closeOnBlur` logic in range picker example             

packages/react-docs/pages/components/date-pickers/date-picker/range-picker.js

  • Added a condition to closeOnBlur to respect isDateTimePickerVisible.
  • Ensures the date-time picker remains open when needed.
  • +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    codesandbox bot commented Feb 12, 2025

    Review or Edit in CodeSandbox

    Open the branch in Web EditorVS CodeInsiders

    Open Preview

    Copy link

    changeset-bot bot commented Feb 12, 2025

    ⚠️ No Changeset found

    Latest commit: 924609e

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Improve state management logic

    Consider using a more explicit state management approach by moving the
    closeOnBlur logic into the onClose handler to prevent potential race conditions
    between state updates and blur events.

    packages/react-docs/pages/components/date-pickers/date-picker/range-picker.js [355-360]

     <Menu
    -  closeOnBlur={!state.isDateTimePickerVisible}
    -  onClose={() => {
    -    if (state.isDateTimePickerVisible) {
    -      setState({ isDateTimePickerVisible: false });
    +  closeOnBlur={false}
    +  onClose={(event) => {
    +    if (state.isDateTimePickerVisible && event?.type === 'blur') {
    +      return;
         }
    +    setState({ isDateTimePickerVisible: false });
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion improves the component's robustness by centralizing blur handling logic in the onClose handler and preventing potential race conditions. The proposed solution provides better control over when the picker should close.

    Medium

    Copy link

    codecov bot commented Feb 12, 2025

    Bundle Report

    Bundle size has no change ✅

    Copy link

    codesandbox-ci bot commented Feb 12, 2025

    This pull request is automatically built and testable in CodeSandbox.

    To see build info of the built libraries, click here or the icon next to each commit SHA.

    Copy link

    codecov bot commented Feb 12, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 79.28%. Comparing base (5744e11) to head (924609e).
    Report is 1 commits behind head on v2.

    Additional details and impacted files
    @@           Coverage Diff           @@
    ##               v2     #973   +/-   ##
    =======================================
      Coverage   79.28%   79.28%           
    =======================================
      Files         404      404           
      Lines        6748     6748           
    =======================================
      Hits         5350     5350           
      Misses       1398     1398           

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Feb 12, 2025

    CI Feedback 🧐

    (Feedback updated until commit 6e2535b)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: deploy

    Failed stage: Deploy to gh-pages [❌]

    Failure summary:

    The action failed due to a Git push conflict. The attempt to push changes to the gh-pages branch was
    rejected because:

  • The remote repository contains new changes that aren't present in the local branch
  • Another repository or process may have pushed to the same branch in the meantime
  • The action needs to perform a git pull to integrate remote changes before pushing

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    612:  ./_next/static/chunks/pages/patterns/notification-3b5ee3f59c4dcf76.js
    613:  ./_next/static/chunks/pages/patterns/table-display-27de56f183712a8d.js
    614:  ./_next/static/chunks/pages/styled-system/
    615:  ./_next/static/chunks/pages/styled-system/style-props-bfe83b14361b4c9d.js
    616:  ./_next/static/chunks/pages/styled-system/responsive-values-5220afdcfec02591.js
    617:  ./_next/static/chunks/pages/styled-system/pseudo-style-props-b986e5bd6e653a45.js
    618:  ./_next/static/chunks/pages/migrations-402a31fed3ff7465.js
    619:  ./_next/static/chunks/pages/icons-56a888fb16d0c891.js
    620:  ./_next/static/chunks/pages/_error-70f1843b45b2e935.js
    ...
    
    688:  ./icons/svg-icon/index.html
    689:  ./icons/index.html
    690:  ./images/
    691:  ./images/tonic-logo-light.svg
    692:  ./images/patterns/
    693:  ./images/patterns/notification/
    694:  ./images/patterns/notification/icon-notification-info.svg
    695:  ./images/patterns/notification/icon-notification-highlight.svg
    696:  ./images/patterns/notification/icon-notification-error.svg
    ...
    
    811:  rename react/pr-973/_next/static/chunks/pages/{_app-65e04b13ee3ba617.js => _app-689cc617b9fdde94.js} (75%)
    812:  create mode 100644 react/pr-973/_next/static/chunks/pages/components/button-base-395d32e5a903f3a5.js
    813:  delete mode 100644 react/pr-973/_next/static/chunks/pages/components/button-base-b7bb3785f8ace47c.js
    814:  delete mode 100644 react/pr-973/_next/static/chunks/pages/components/tag-684fa0fa37bdcbce.js
    815:  create mode 100644 react/pr-973/_next/static/chunks/pages/components/tag-894e117e23d58e29.js
    816:  rename react/pr-973/_next/static/chunks/pages/customization/{shadow-dom-3a8f7c738d343d40.js => shadow-dom-656228a76ee8eaa4.js} (95%)
    817:  To github.com:trendmicro-frontend/tonic-ui-demo.git
    818:  ! [rejected]          gh-pages -> gh-pages (fetch first)
    819:  error: failed to push some refs to 'github.com:trendmicro-frontend/tonic-ui-demo.git'
    820:  hint: Updates were rejected because the remote contains work that you do not
    821:  hint: have locally. This is usually caused by another repository pushing to
    822:  hint: the same ref. If you want to integrate the remote changes, use
    823:  hint: 'git pull' before pushing again.
    824:  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    825:  ##[error]Process completed with exit code 1.
    

    @trendmicro-frontend-bot
    Copy link
    Contributor

    trendmicro-frontend-bot commented Feb 12, 2025

    Tonic UI Demo

    On 2025-02-12 09:06:09 +0000, PR #973 (924609e) was successfully deployed. You can view it at the following link:
    https://trendmicro-frontend.github.io/tonic-ui-demo/react/pr-973/

    @cheton cheton merged commit 658525b into v2 Feb 12, 2025
    8 checks passed
    @cheton cheton deleted the tonic-ui-969 branch February 12, 2025 09:26
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    DatePicker does not remain open when user changes the year
    2 participants