Skip to content

Finishing touches with regard to header improvements#15683

Merged
andreslucena merged 21 commits intodevelopfrom
feature/header-improvements
Feb 6, 2026
Merged

Finishing touches with regard to header improvements#15683
andreslucena merged 21 commits intodevelopfrom
feature/header-improvements

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Nov 29, 2025

🎩 What? Why?

In this PR, i am handling issues reported by #15299.

  • When you enter a component within a process (for example), the breadcrumb disappears and does not allow you to navigate (mobile)
  • arrow_link helper should be renamed to better reflect its new behaviour
  • On mobile, when I navigate to a conference program, the breadcrumb shows the [All] Conferences link instead of the Conference title. I'd expect to go back to the Conference homepage through the Conference title, since this is the only way to access the Program in the first place.
  • Change the color of the disable to the one used elsewhere on the website (see reference).
  • All of the selectors on decidim-core/app/packs/src/decidim/dropdown_menu.js should be migrated to data selectors
  • The menu is the only thing that is enabled once it is opened.

📌 Related Issues

Link your PR to an issue

  • Related to #?
  • Fixes #?

Testing

Describe the best way to test or validate your PR.

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

Summary by CodeRabbit

  • New Features

    • Redesigned main dropdown behavior: smoother open/close, keyboard (Escape) support, scroll locking, and improved ARIA state handling.
    • Added a subtle backdrop overlay behind dropdowns for clearer visual focus.
    • Role assignment for dropdown containers to improve assistive tech recognition.
  • Bug Fixes

    • Mobile breadcrumb navigation now skips empty entries and falls back gracefully.
  • Tests

    • Added comprehensive tests covering dropdown behavior, accessibility and role-assignment.

github-actions[bot]
github-actions bot previously approved these changes Nov 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Nov 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Nov 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Nov 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Nov 29, 2025
@andreslucena
Copy link
Copy Markdown
Member

@alecslupu as this PR will have 18 fixes (!!!), I kindly ask you to be really clear in the commit messages (basically copy-pasting or rephrasing the fix from the issue) or just create a new PR for each fix. If not I'm affraid that this will be a nightmare to actual review, and you'll need to do the work two times (extracting the fixes in multiple PRs for instance once we realize that the changes are not easy to review and take too much time).

@andreslucena
Copy link
Copy Markdown
Member

Feel free to rewrite the current git commit history until it is ready for a review, as I didn't review it yet.

@alecslupu
Copy link
Copy Markdown
Contributor Author

alecslupu commented Dec 4, 2025

Feel free to rewrite the current git commit history until it is ready for a review, as I didn't review it yet.

I will do it.
Addressing your concerns, regarding 18 fixes: Sometimes one fix can address 2 issues.
If you want, i can extract them in their own PR, but that may impact the way you can review, as you may not see how all things fit together.
However, i see that 1 or 2 items from the checklist could be extracted separately ( specs, breadcrumb ), leaving only CSS issues behind.

Allow me to get back to this (waiting for Frontend).

@andreslucena
Copy link
Copy Markdown
Member

However, i see that 1 or 2 items from the checklist could be extracted separately ( specs, breadcrumb ), leaving only CSS issues behind.

That'd be great!

github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2025
github-actions[bot]
github-actions bot previously approved these changes Feb 4, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@decidim-core/app/packs/src/decidim/controllers/main_menu/controller.js`:
- Around line 92-97: closeMenu currently restores document.body.style.overflow
to this.previousBodyOverflow and then immediately overwrites it with "scroll";
change the overflow assignment so it uses the saved value with a fallback
instead of always forcing "scroll" — i.e. in closeMenu update the single
overflow assignment to set document.body.style.overflow =
this.previousBodyOverflow ?? "scroll" (remove the separate assignment), keeping
the existing aria attribute updates on this.element and this.menuContainer
intact.
- Around line 83-86: The lint failure is due to comparing
this.previousBodyOverflow directly to undefined; update the check in the
openMenu method so it uses a typeof test instead (e.g., check if typeof
this.previousBodyOverflow === "undefined") to satisfy the linter and avoid
direct undefined comparison while preserving the existing logic that assigns
document.body.style.overflow to this.previousBodyOverflow only when it hasn't
been set.
🧹 Nitpick comments (1)
decidim-core/app/views/layouts/decidim/header/_main_links_mobile_account.html.erb (1)

41-53: Consider modernizing deprecated keyCode usage.

The keyCode property is deprecated. While still functional, using event.key is the modern approach and more readable.

♻️ Suggested modernization
   closeDiv.addEventListener('keydown', function(e){
-    if (e.keyCode === 13 || e.keyCode === 32) {
+    if (e.key === 'Enter' || e.key === ' ') {
       menuDropdown.removeAttribute('aria-modal');
       menuDropdown.setAttribute('aria-hidden', "true");
       dropdownTrigger.focus();
     }
   })

Additionally, this inline script could be migrated to a Stimulus controller to align with the broader refactoring effort in this PR.

github-actions[bot]
github-actions bot previously approved these changes Feb 4, 2026
@alecslupu
Copy link
Copy Markdown
Contributor Author

This wasn't done:

#15299 (comment)

I am pretty sure this is done back in #15737

The reviewed code was :
image

And the implementation was done in 3eb031d

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@decidim-core/app/packs/src/decidim/controllers/assign_role/assign_role.test.js`:
- Around line 48-61: The test sets a spy on global.setTimeout before switching
to fake timers, so the spy wraps the real function and is bypassed when
jest.useFakeTimers() replaces setTimeout; to fix, call jest.useFakeTimers()
before creating the spy (i.e., move jest.spyOn(global, "setTimeout") to after
jest.useFakeTimers()), keep the rest of the test logic around
controller.disconnect() / controller.connect(), and ensure timers are advanced
and assertions run as before (optionally restore timers/spies after the test).

github-actions[bot]
github-actions bot previously approved these changes Feb 4, 2026
@alecslupu
Copy link
Copy Markdown
Contributor Author

@andreslucena , let me know if the getElementById answers are satisfactory. This should be ready for another round

@andreslucena
Copy link
Copy Markdown
Member

There's still a scroll weird behavior in this other menu:

image

Can you fix it too please? Thanks!

@andreslucena
Copy link
Copy Markdown
Member

When the menu is opened in desktop, clicking outside of it doesn't get it closed:

image

github-actions[bot]
github-actions bot previously approved these changes Feb 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@decidim-core/app/packs/stylesheets/decidim/_header.scss`:
- Around line 130-132: The dropdown backdrop (&__dropdown) uses "absolute top-0
right-0" so it only sizes to content; change it to cover the full viewport by
using a fixed, full-bleed positioning (e.g. replace "absolute top-0 right-0"
with "fixed inset-0") or alternatively ensure "left-0 w-full" plus the existing
"h-screen" and a high z-index so the overlay covers the whole viewport and
prevents interaction outside the menu; update the `@apply` on &__dropdown
accordingly.
🧹 Nitpick comments (1)
decidim-core/app/packs/src/decidim/controllers/main_menu/controller.js (1)

99-107: Avoid restoring a stale overflow value between openings.

previousBodyOverflow is captured only once, so if another overlay updates document.body.style.overflow between menu openings, closing the menu could restore an outdated value and re-enable scroll unexpectedly. Capturing on each open avoids that drift.

♻️ Suggested change
   openMenu() {
-    if (typeof this.previousBodyOverflow === "undefined") {
-      this.previousBodyOverflow = document.body.style.overflow;
-    }
+    this.previousBodyOverflow = document.body.style.overflow
     document.body.style.overflow = "hidden"
     this.element.setAttribute("aria-expanded", "true")
     this.menuContainer.setAttribute("aria-hidden", "false")
     this.menuContainer.setAttribute("aria-modal", "true")
   }

@alecslupu
Copy link
Copy Markdown
Contributor Author

@andreslucena this should be ready for another round ...

@andreslucena
Copy link
Copy Markdown
Member

Merging with the failure of codecov

@andreslucena andreslucena merged commit 9af7da0 into develop Feb 6, 2026
85 of 87 checks passed
@andreslucena andreslucena deleted the feature/header-improvements branch February 6, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants