-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: Improve Yearly Reading Goal modal for better usability and clarity #11343
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
Changes from 1 commit
9f165f3
a8015ce
ac5f5eb
69b4325
cd469a3
d4584a8
ebaedfc
637d764
6ffb124
10ab0d7
3a62cee
446aef8
a94cba9
c8143ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,13 +5,20 @@ | |||||
| <input type="hidden" name="year" value="$year_value"> | ||||||
| $if update: | ||||||
| <input type="hidden" name="is_update" value="true"> | ||||||
| <span>$_("How many books would you like to read this year?")</span> | ||||||
| $ 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> | ||||||
| <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> | ||||||
| $if not goal: | ||||||
| <a class="goal-form__learn-more" href="https://blog.openlibrary.org/2022/12/31/reach-your-2023-reading-goals-with-open-library" target="_blank">$_('Learn More')</a> | ||||||
| </div> | ||||||
|
|
||||||
| $if goal: | ||||||
| <div class="small">$_('Enter "0" to unset your reading goal. Your check-ins will be preserved.')</div> | ||||||
| $else: | ||||||
| <a class="small" href="https://blog.openlibrary.org/2022/12/31/reach-your-2023-reading-goals-with-open-library" target="_blank">$_('Learn More')</a> | ||||||
| <div class="goal-form__note">$_('Enter "0" to unset your reading goal. Your check-ins will be preserved.')</div> | ||||||
|
|
||||||
| <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> | ||||||
|
||||||
| <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?.
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a surprising amount of additions. My understanding was that the layout was the only thing that was going to change. |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,17 +1,109 @@ | ||||||||||
| /* Styles for the yearly reading goal form */ | ||||||||||
| .goal-form { | ||||||||||
| font-size: @font-size-title-medium; | ||||||||||
| display: flex; | ||||||||||
| flex-direction: column; | ||||||||||
| gap: 10px; | ||||||||||
| text-align: center; | ||||||||||
|
|
||||||||||
| button { | ||||||||||
| display: inline-block; | ||||||||||
| width: fit-content; | ||||||||||
| margin-left: 10px; | ||||||||||
| &__question { | ||||||||||
| display: flex; | ||||||||||
| flex-direction: row; | ||||||||||
| gap: 8px; | ||||||||||
| align-items: center; | ||||||||||
| justify-content: center; | ||||||||||
|
|
||||||||||
| span { | ||||||||||
| font-weight: 500; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| &__learn-more { | ||||||||||
| font-size: @font-size-label-small; | ||||||||||
| color: @dark-grey; | ||||||||||
| text-decoration: none; | ||||||||||
|
|
||||||||||
| &:hover { | ||||||||||
| text-decoration: underline; | ||||||||||
| } | ||||||||||
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| &__input-section { | ||||||||||
| display: flex; | ||||||||||
| justify-content: flex-end; | ||||||||||
| align-items: center; | ||||||||||
| gap: 15px; | ||||||||||
| padding-right: 5px; | ||||||||||
| width: 100%; | ||||||||||
|
|
||||||||||
| input { | ||||||||||
| width: 100px; | ||||||||||
| padding: 10px 14px; | ||||||||||
| font-size: @font-size-label-large; | ||||||||||
| text-align: center; | ||||||||||
| border: 2px solid @lighter-grey; | ||||||||||
| border-radius: 4px; | ||||||||||
| outline: none; | ||||||||||
|
|
||||||||||
| &:focus { | ||||||||||
| border-color: @primary-blue; | ||||||||||
| box-shadow: 0 0 0 2px fade(@primary-blue, 20%); | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| button { | ||||||||||
| display: inline-block; | ||||||||||
| width: fit-content; | ||||||||||
| margin: 0; | ||||||||||
| padding: 9px 20px; | ||||||||||
| font-size: @font-size-label-large; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| &__submit-section { | ||||||||||
| // This section is no longer needed as button is moved to input section | ||||||||||
| display: none; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
||||||||||
| &__submit-section { | |
| // This section is no longer needed as button is moved to input section | |
| display: none; | |
| } |
Outdated
Copilot
AI
Oct 9, 2025
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.
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; |
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.
Add an
idhere, so this can be referenced byaria-labelledby.