-
Notifications
You must be signed in to change notification settings - Fork 105
fix: schedule imbalance fix #889
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
base: enext
Are you sure you want to change the base?
fix: schedule imbalance fix #889
Conversation
Reviewer's GuideTo prevent header wrapping when an event has many locales, this PR refactors CSS to enforce flex-nowrap and adds dedicated styling for inline and dropdown locale links (plus user-logs), updates the base template to render locales as an inline list when ≤3 or a dropdown when >3 (including a new script reference), and introduces a small JS module that closes open dropdowns on outside clicks.
Class diagram for dropdown JS moduleclassDiagram
class DropdownManager {
+initDropdowns()
}
class "document" {
}
DropdownManager -- "document" : interacts with
DropdownManager : +initDropdowns()
DropdownManager : +eventListener('click')
DropdownManager : +eventListener('DOMContentLoaded')
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Consider extracting the hardcoded
>3
threshold for switching between inline locale links and the dropdown into a configurable constant or template variable so it can be adjusted without editing code. - Improve dropdown accessibility by adding keyboard support (e.g. Escape to close, arrow navigation, focus management) and appropriate ARIA attributes on the
<summary>
and menu items. - Instead of manually inserting
%3F
when building thenext
query parameter, use Django’surlencode
orrequest.get_full_path
to compose the full URL and avoid potential encoding issues.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the hardcoded `>3` threshold for switching between inline locale links and the dropdown into a configurable constant or template variable so it can be adjusted without editing code.
- Improve dropdown accessibility by adding keyboard support (e.g. Escape to close, arrow navigation, focus management) and appropriate ARIA attributes on the `<summary>` and menu items.
- Instead of manually inserting `%3F` when building the `next` query parameter, use Django’s `urlencode` or `request.get_full_path` to compose the full URL and avoid potential encoding issues.
## Individual Comments
### Comment 1
<location> `app/eventyay/static/cfp/css/_layout.css:49` </location>
<code_context>
align-items: flex-end;
- word-break: break-word;
+ word-break: keep-all;
+ flex-wrap: nowrap;
}
#header-tabs {
</code_context>
<issue_to_address>
**issue:** Using 'flex-wrap: nowrap' may cause layout overflow on smaller screens.
Please verify that the layout remains usable on small screens with many tabs or locale links, as nowrap may prevent content from wrapping and cause overflow.
</issue_to_address>
### Comment 2
<location> `app/eventyay/static/cfp/css/_layout.css:59` </location>
<code_context>
border-radius: var(--size-border-radius) var(--size-border-radius) 0 0;
margin-bottom: -4px;
padding-bottom: 4px;
+ flex-shrink: 0;
a.header-tab {
padding: 8px 10px 4px 10px;
</code_context>
<issue_to_address>
**suggestion:** Adding 'flex-shrink: 0' may reduce flexibility for header elements.
This change may lead to header overflow on smaller screens. Consider applying 'flex-shrink: 0' only when necessary, based on screen size.
Suggested implementation:
```
```
```
#header-tabs {
display: flex;
flex-wrap: nowrap;
z-index: 400;
background: var(--color-bg);
border-radius: var(--size-border-radius) var(--size-border-radius) 0 0;
margin-bottom: -4px;
padding-bottom: 4px;
}
@media (min-width: 600px) {
#header-tabs {
flex-shrink: 0;
}
}
#header-tabs a.header-tab {
padding: 8px 10px 4px 10px;
border-bottom: 2px solid transparent;
color: white;
margin-left: auto;
display: flex;
flex-wrap: nowrap;
flex-shrink: 0;
```
</issue_to_address>
### Comment 3
<location> `app/eventyay/common/templates/common/base.html:109` </location>
<code_context>
+ </summary>
+ <div id="locale-dropdown" class="dropdown-content dropdown-content-s{% if rtl %}e{% else %}w{% endif %}">
+ {% for l, name in request.event.named_locales %}
+ <a href="{% url "cfp:locale.set" event=request.event.slug %}?locale={{ l }}&next={{ request.path }}%3F{{ request.META.QUERY_STRING|urlencode }}"
+ class="dropdown-item {% if l|lower == request.LANGUAGE_CODE|lower %}active{% endif %}" role="menuitem" tabindex="-1">{{ name }}</a>
+ {% endfor %}
</code_context>
<issue_to_address>
**issue:** URL encoding for 'next' parameter may be inconsistent between dropdown and inline links.
Please standardize the URL encoding logic for the 'next' parameter in both dropdown and inline links to prevent navigation errors with complex query strings.
</issue_to_address>
### Comment 4
<location> `app/eventyay/static/common/js/dropdown.js:4-15` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/JavaScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>
### Comment 5
<location> `app/eventyay/static/common/js/dropdown.js:6` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/JavaScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
align-items: flex-end; | ||
word-break: break-word; | ||
word-break: keep-all; | ||
flex-wrap: nowrap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Using 'flex-wrap: nowrap' may cause layout overflow on smaller screens.
Please verify that the layout remains usable on small screens with many tabs or locale links, as nowrap may prevent content from wrapping and cause overflow.
Fixes #386 of eventyay-talk high number of locales seemed to be the breaking factor if locales are high a dropdown approach is now used
Summary by Sourcery
Prevent header layout break when there are many locales by introducing a conditional locale selection dropdown, updating CSS layout rules, and adding dropdown behavior via JavaScript.
Bug Fixes:
Enhancements: