fix: Improve Yearly Reading Goal modal for better usability and clarity#11343
Conversation
| <div class="goal-form__input-section"> | ||
| $ goal_value = goal if goal else '' | ||
| $ min_value = 0 if goal else 1 | ||
| <input type="number" name="goal" min="$min_value" step="1" value="$goal_value" max="10000" required> |
There was a problem hiding this comment.
Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.
There was a problem hiding this comment.
Pull Request Overview
This PR improves the Yearly Reading Goal modal by implementing design enhancements focused on better usability and visual clarity. The changes reorganize the modal layout and improve typography for enhanced user experience.
- Restructured modal with vertical layout and improved element positioning
- Enhanced typography with larger font sizes for better readability
- Added responsive design optimizations for mobile devices
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| static/css/components/reading-goal.less | Complete redesign of CSS styles with flexbox layout, responsive breakpoints, and improved typography |
| openlibrary/templates/reading_goals/reading_goal_form.html | Restructured HTML template to support new layout with reorganized sections and conditional content placement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| &__submit-section { | ||
| // This section is no longer needed as button is moved to input section | ||
| display: none; | ||
| } | ||
|
|
There was a problem hiding this comment.
Instead of hiding unused sections with display: none, consider removing the CSS rule entirely or removing the corresponding HTML element. Hidden elements can cause confusion and add unnecessary code bloat.
| &__submit-section { | |
| // This section is no longer needed as button is moved to input section | |
| display: none; | |
| } |
|
|
||
| &__input-section { | ||
| gap: 12px; | ||
| flex-direction: row; |
There was a problem hiding this comment.
The flex-direction: row property is redundant here since row is the default value for flexbox containers. This line can be removed to reduce code duplication.
| flex-direction: row; |
|
PTAL @jimchamp, thanks. |
|
@akramcodez the new designs look reasonable to us! We'll review the remaining issues shortly. |
There was a problem hiding this comment.
My understanding was that this was going to be a simple layout change. Your changes include font size and weight changes, a new hover state, etc. Staff already looked at your screenshots during our meeting today, and they approved --- so don't worry about reverting non-layout changes unless otherwise indicated. Just be sure to keep future PRs tightly scoped to the issue that they are meant to solve.
I've added some notes describing how to address the accesslint comment.
Also noting that your style changes are causing the modal to overflow on the x-axis on smaller screens in firefox:
That will have to be addressed before this can be merged.
One last thing: You mentioned Enhanced Focus States: Improved input field focus indicators as a change that you made. Can you explain how the focus indicators were improved? The improvements were not obvious to me.
| <div class="goal-form__input-section"> | ||
| $ goal_value = goal if goal else '' | ||
| $ min_value = 0 if goal else 1 | ||
| <input type="number" name="goal" min="$min_value" step="1" value="$goal_value" max="10000" required> |
There was a problem hiding this comment.
| <input type="number" name="goal" min="$min_value" step="1" value="$goal_value" max="10000" required> | |
| <input type="number" name="goal" min="$min_value" step="1" value="$goal_value" max="10000" aria-labelledby="yearly-goal-prompt" required> |
This one is a little tricky, as there is no <label> element associated with the input. I think that we can use aria-labelledby here, as long as we add an id to the element containing the string How many books would you like to read this year?.
| <button class="cta-btn cta-btn--shell reading-goal-submit-button" type="submit" data-ol-link-track="YearlyReadingGoals|SubmitGoal">$_("Submit")</button> | ||
|
|
||
| <div class="goal-form__question"> | ||
| <span>$_("How many books would you like to read this year?")</span> |
There was a problem hiding this comment.
| <span>$_("How many books would you like to read this year?")</span> | |
| <span id="yearly-goal-prompt">$_("How many books would you like to read this year?")</span> |
Add an id here, so this can be referenced by aria-labelledby.
There was a problem hiding this comment.
This is a surprising amount of additions. My understanding was that the layout was the only thing that was going to change.
| &:hover { | ||
| text-decoration: underline; | ||
| } |
There was a problem hiding this comment.
What is this hover state? You didn't mention anything about this here.
Please remove this. The link is underlined to begin with.
|
@jimchamp added the changes. Sorry for the off-topic changes. Please let me know if there are any issues. added a focus |
|
@jimchamp if there’s any issue, please let me know |
jimchamp
left a comment
There was a problem hiding this comment.
Sorry for the delay, @akramcodez.
I cannot merge this until the overflow issue is fixed for smaller screen sizes (mentioned here).
I still don't understand how the focus indicators were improved. Can you tell me?
|
@jimchamp The focus indicator I meant the blue border that appears when the input is active or triggered maybe I described it incorrectly earlier sorry about that. |
jimchamp
left a comment
There was a problem hiding this comment.
I scrolled right past your "Before" picture in this post -- sorry about that! The focus indicators appear blue in production today in FF, but not in Chrome (which I didn't know).
The x-overflow issue is happening in production today, and is unrelated to these changes (again -- so sorry!).
It might make sense to rollback the previous commit if the changes were made solely for the purpose of fixing the overflow.
| } | ||
| } | ||
|
|
||
| @media only screen and (max-width: 480px) { |
There was a problem hiding this comment.
We can't have hard-coded breakpoints. Please use one of these three
There was a problem hiding this comment.
The scrolling on the x-axis is still happening on mobile devices, but it likely doesn't have anything to do with the modal. If a patron's reading log visibility is public, a Share link will appear to the right of the following counts on "My Books" pages. This link is causing the overflow (sorry about that).
It may make sense to revert the last commit if the changes were only meant to correct the overflow.
|
@jimchamp that’s completely okay, I learned a lot from this issue. Instead of reverting that commit, I just removed the small-screen CSS and also adjusted the input and submit button sizes.
|
jimchamp
left a comment
There was a problem hiding this comment.
Thanks for your patience, @akramcodez!








Fixes #11324
Description
This PR implements the design improvements suggested in issue #11324 to enhance the "Yearly Reading Goal" modal's usability and visual clarity.
Changes Made
Layout Improvements
Typography & Styling
Responsive Design
Screenshots
Before
After