Skip to content

feat(ui): no-(re)focus properties passed to the QMenu of QBtnDropdown #17802

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

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

jclaveau
Copy link
Contributor

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)

  • It's been tested on a Cordova (iOS, Android) app

  • It's been tested on an Electron app
    => ui test fail on a fresh install so I'll count on the tests of the CI
    image

  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

This is required to avoid loosing the focus/selection of a contenteditable while clicking inside the dropdown like here:
image

Other information:
Should this be retested as it is already by QMenu?

Copy link

Build Results

JSON API

📜 Changes detected:

diff --git a/./current-build/api/QBtnDropdown.json b/./pr-build/api/QBtnDropdown.json
index d45ac34..b58b9bc 100644
--- a/./current-build/api/QBtnDropdown.json
+++ b/./pr-build/api/QBtnDropdown.json
@@ -383,6 +383,16 @@
       "desc": "Allows any click/tap in the menu to close it; Useful instead of attaching events to each menu item that should close the menu on click/tap",
       "category": "behavior"
     },
+    "no-refocus": {
+      "type": "Boolean",
+      "desc": "(Accessibility) When the dropdown gets hidden, do not refocus on the DOM element that previously had focus",
+      "category": "behavior"
+    },
+    "no-focus": {
+      "type": "Boolean",
+      "desc": "(Accessibility) When the dropdown gets shown, do not switch focus on it",
+      "category": "behavior"
+    },
     "menu-anchor": {
       "type": "String",
       "desc": "Two values setting the starting position or anchor point of the menu relative to its target",

Types

📜 Changes detected:

diff --git a/./current-build/types/index.d.ts b/./pr-build/types/index.d.ts
index 09ccc1b..2fbff96 100644
--- a/./current-build/types/index.d.ts
+++ b/./pr-build/types/index.d.ts
@@ -4094,6 +4094,14 @@ export interface QBtnDropdownProps {
    * Allows any click/tap in the menu to close it; Useful instead of attaching events to each menu item that should close the menu on click/tap
    */
   autoClose?: boolean | undefined;
+  /**
+   * (Accessibility) When the dropdown gets hidden, do not refocus on the DOM element that previously had focus
+   */
+  noRefocus?: boolean | undefined;
+  /**
+   * (Accessibility) When the dropdown gets shown, do not switch focus on it
+   */
+  noFocus?: boolean | undefined;
   /**
    * Two values setting the starting position or anchor point of the menu relative to its target
    * Default value: 'bottom end'

Copy link

UI Tests Results

    1 files     98 suites   39s ⏱️
1 031 tests 1 031 ✅ 0 💤 0 ❌
1 050 runs  1 050 ✅ 0 💤 0 ❌

Results for commit e769391.

@rstoenescu rstoenescu merged commit 1316370 into quasarframework:dev Feb 27, 2025
1 of 3 checks passed
@rstoenescu
Copy link
Member

Thanks for contributing!

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