Skip to content

fix: set clickOutsideDeactivates#8284

Merged
skjnldsv merged 1 commit intomainfrom
fix/use-outside-click-deactivate
Apr 1, 2026
Merged

fix: set clickOutsideDeactivates#8284
skjnldsv merged 1 commit intomainfrom
fix/use-outside-click-deactivate

Conversation

@grnd-alt
Copy link
Copy Markdown
Contributor

@grnd-alt grnd-alt commented Mar 9, 2026

☑️ Resolves

Having the left sidebar (AppNavigation) and the right sidebar open at the same time and being on a mobile screen, causes the focus trap to block all focus. Clicks outside are allowed but focusing anything is not, so it is not possible to share on a small screen when both sidebars are shown.

⚠️ This also applies to files, not just deck! (possibly other apps but I've only tested those)

🖼️ Screenshots

🏚️ Before (I am clicking on the input element the entire time)

screenrecording-2026-03-09_11-31-03.mp4

🏡 After

screenrecording-2026-03-23_15-39-55.mp4

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@grnd-alt grnd-alt force-pushed the fix/use-outside-click-deactivate branch 2 times, most recently from 83e71fd to 6b56593 Compare March 9, 2026 14:33
@grnd-alt grnd-alt requested review from ShGKme and susnux March 9, 2026 14:33
@susnux susnux added bug Something isn't working 3. to review Waiting for reviews labels Mar 9, 2026
@susnux susnux added this to the 9.6.0 milestone Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.09%. Comparing base (d57b6bf) to head (bfa53db).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/components/NcAppNavigation/NcAppNavigation.vue 0.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8284      +/-   ##
==========================================
- Coverage   54.17%   54.09%   -0.08%     
==========================================
  Files         104      104              
  Lines        3393     3398       +5     
  Branches      989      989              
==========================================
  Hits         1838     1838              
- Misses       1317     1321       +4     
- Partials      238      239       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@grnd-alt
Copy link
Copy Markdown
Contributor Author

/backport to stable8

@grnd-alt grnd-alt force-pushed the fix/use-outside-click-deactivate branch 5 times, most recently from 7604c35 to a19546a Compare March 18, 2026 12:49
Copy link
Copy Markdown
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Makes sense to me

focusTrap = createFocusTrap(appNavigationContainerElement.value!, {
allowOutsideClick: true,
clickOutsideDeactivates: (event) => {
if (isMobile.value && event.target instanceof HTMLInputElement) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why only on click on native inputs?

Copy link
Copy Markdown
Contributor

@Antreesy Antreesy Mar 25, 2026

Choose a reason for hiding this comment

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

Yeah, we have this issue also with clicking on AccountMenu in top-right and other elements

#5385

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ShGKme to only close when focus will change, otherwise the navigation closes on every click that happens.
In reference to the screen recording the navigation would close when opening the right sidebar not when clicking on the user search.

I am also fine to always close on outside click if you prefer that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to only close when focus will change, otherwise the navigation closes on every click that happens.

IMHO this makes sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would expect closing also without changed focus, e.g. navigation is covering chat/form/files list.

But it should respect popovers and dialogs open inside this navigation context (e.g. NcListItem with actions mounted inside NcApNavigation -> actions popover might be mounted to body, but it's still belong to the element inside of navigation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

tested around a bit more and to prevent cases like below It seems like it makes more sense to always close on clickOutSide, modals etc. are not considered clickOutside if they're mounted in the navigation so that will keep the navigation open.

image

Signed-off-by: grnd-alt <git@belakkaf.net>
@grnd-alt grnd-alt force-pushed the fix/use-outside-click-deactivate branch from a19546a to bfa53db Compare March 30, 2026 08:57
@grnd-alt grnd-alt requested review from Antreesy and ShGKme March 30, 2026 08:57
@skjnldsv skjnldsv merged commit 08100af into main Apr 1, 2026
25 of 27 checks passed
@skjnldsv skjnldsv deleted the fix/use-outside-click-deactivate branch April 1, 2026 07:59
@backportbot
Copy link
Copy Markdown

backportbot Bot commented Apr 1, 2026

The backport to stable8 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable8
git pull origin stable8

# Create the new backport branch
git checkout -b backport/8284/stable8

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick bfa53db3

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/8284/stable8

Error: Failed to check for changes with origin/stable8: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews backport-request bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants