Skip to content

Conversation

Saksham-Sirohi
Copy link
Contributor

@Saksham-Sirohi Saksham-Sirohi commented Aug 4, 2025

Fixes #386 as a high number of locales was the major cause of the breakdown, and it has been converted to a dropdown approach also some changes to flex have been made to keep it from breaking

Summary by Sourcery

Prevent header layout issues with many locales by converting locale links into a dropdown and tightening flex container settings.

Bug Fixes:

  • Fix header breakdown when displaying a large number of locales by switching to a dropdown menu

Enhancements:

  • Enforce nowrap and disable shrinking on header flex containers to prevent wrapping glitches
  • Transform inline locale links into a
    dropdown with summary and styled items
  • Introduce a dropdown.js script to close open dropdowns on outside clicks

Copy link

sourcery-ai bot commented Aug 4, 2025

Reviewer's Guide

Refactors the locale switcher into a

-based dropdown with new JS for outside-click handling, and updates layout.css to enforce nowrap flex layouts and style the dropdown menu.

Sequence diagram for locale dropdown interaction and outside click handling

sequenceDiagram
    actor User
    participant Header as Header (HTML)
    participant Dropdown as Dropdown JS
    participant System as Server
    User->>Header: Clicks on locale dropdown
    Header->>Dropdown: Dropdown opens
    User->>Dropdown: Clicks outside dropdown
    Dropdown->>Header: Dropdown closes
    User->>Header: Selects a locale
    Header->>System: Navigates to locale set URL
    System-->>User: Page reloads with new locale
Loading

Class diagram for updated locale dropdown structure

classDiagram
    class Header {
        +locales : DetailsDropdown
    }
    class DetailsDropdown {
        +summary : string
        +dropdownContent : DropdownContent
    }
    class DropdownContent {
        +dropdownItem : list<DropdownItem>
    }
    class DropdownItem {
        +href : string
        +active : bool
        +name : string
    }
    Header --> DetailsDropdown
    DetailsDropdown --> DropdownContent
    DropdownContent --> DropdownItem
Loading

Class diagram for dropdown.js outside click handler

classDiagram
    class DropdownJS {
        +initDropdowns()
        +handleClickOutside(event)
    }
    DropdownJS : Listens for document click
    DropdownJS : Closes open dropdowns if click is outside
Loading

File-Level Changes

Change Details Files
Convert locale links into a native dropdown component
  • Replace inline list of locale links with
    / structure
  • Wrap options in a dropdown-content div with dropdown-item classes
  • Include new dropdown.js to handle closing on outside clicks
src/pretalx/common/templates/common/base.html
src/pretalx/static/common/js/dropdown.js
Update layout.css to prevent header flex wrap issues and style dropdown
  • Change flex-wrap to nowrap and add flex-shrink: 0 on header containers
  • Add summary { cursor: pointer } and dropdown-content positioning/border rules
  • Define dropdown-item hover and active state styles
src/pretalx/static/cfp/css/_layout.css

Assessment against linked issues

Issue Objective Addressed Explanation
#386 Fix the imbalance in the navigation bar in the schedule view when the schedule grid is narrow (e.g., 2 columns), as shown in the provided screenshot.
#386 Refactor the locale selection in the navigation bar from a horizontal list of links to a dropdown to prevent layout breakage when there are many locales.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Saksham-Sirohi - I've reviewed your changes - here's some feedback:

  • Enhance accessibility by toggling aria-expanded on the element and adding a keydown handler (e.g. Escape) to close the dropdown for keyboard users.
  • Consider including a small polyfill or fallback for details/summary so the locale dropdown still works in browsers that don’t fully support those elements.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Enhance accessibility by toggling aria-expanded on the <summary> element and adding a keydown handler (e.g. Escape) to close the dropdown for keyboard users.
- Consider including a small polyfill or fallback for details/summary so the locale dropdown still works in browsers that don’t fully support those elements.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@mariobehling
Copy link
Member

Please share a screenshot.

@Saksham-Sirohi
Copy link
Contributor Author

Saksham-Sirohi commented Aug 6, 2025

@mariobehling Please see attached

2025-08-06.19-40-24.mov

@Saksham-Sirohi
Copy link
Contributor Author

@mariobehling functionality has been updated to only use the dropdown when the number of available locales exceeds 3. Also, wrapping seemed to be breaking words have administered a fix for this

@mariobehling
Copy link
Member

Thanks. We are moving to enext. Please make the update there. Thanks!

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.

Imbalance navigation bar in schedule view
2 participants