Skip to content

Fix past activities tab resetting to upcoming when paginating#682

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-past-activities-navigation
Draft

Fix past activities tab resetting to upcoming when paginating#682
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-past-activities-navigation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Navigating to a different page in the past activities section always reset the view to the upcoming tab because the Stimulus tabs controller initialized with indexValue = 0 unconditionally, and the tab <button> elements had no value attribute making change() non-functional.

Changes

  • Tab buttons → anchor links with URL-based hrefs (/events for upcoming, /events?tab=1 for past), delegating tab switching to Turbo navigation instead of client-side JS
  • data-tabs-index-value="<%= params[:tab].to_i %>" added to the controller element so the Stimulus Tabs controller initializes from the server-rendered URL param on every page load
  • data-turbo-action="replace" on tab links to avoid polluting browser history with tab state
  • role="tab" added for accessibility (the controller already manages aria-selected dynamically)
<div data-controller="tabs"
     data-tabs-index-value="<%= params[:tab].to_i %>"
     data-tabs-active-tab="...">
  <a href="<%= events_path %>" role="tab" data-turbo-action="replace" data-tabs-target="tab">Binnenkort</a>
  <a href="<%= events_path(tab: 1) %>" role="tab" data-turbo-action="replace" data-tabs-target="tab">Vroegâh</a>

Pagy naturally propagates tab=1 through all pagination links via request.GET, so no changes to the pagination partial or controller are needed. The full navigation chain: /events?tab=1 → Pagy generates /events?tab=1&page=N → each page renders with data-tabs-index-value="1".

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ddnexus.github.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…pages

- Change tab buttons to anchor links with URL-based navigation (events_path for upcoming, events_path(tab: 1) for past)
- Add data-tabs-index-value from params[:tab] so the Stimulus Tabs controller initializes to the correct tab on page load
- Add data-turbo-action="replace" for better browser history behavior
- Add role="tab" for accessibility

When navigating to /events?tab=1, the server renders with data-tabs-index-value="1" and Pagy includes tab=1 in all pagination links (via request.GET). Clicking a pagination link navigates to /events?tab=1&page=N, which again renders with the past tab selected.

Agent-Logs-Url: https://github.com/DispuutHamers/webapp/sessions/ea1ab744-e12e-48cc-a394-f1b410d59536

Co-authored-by: koenjdejong <74268574+koenjdejong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix navigation issue in past activities page Fix past activities tab resetting to upcoming when paginating Apr 2, 2026
Copilot AI requested a review from koenjdejong April 2, 2026 13:37
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.

Changing pages in past activities switches back to upcoming activities

2 participants