Skip to content

fix: Improve Yearly Reading Goal modal for better usability and clarity#11343

Merged
jimchamp merged 14 commits intointernetarchive:masterfrom
akramcodez:fix/improve-reading-goal-modal-ux
Nov 11, 2025
Merged

fix: Improve Yearly Reading Goal modal for better usability and clarity#11343
jimchamp merged 14 commits intointernetarchive:masterfrom
akramcodez:fix/improve-reading-goal-modal-ux

Conversation

@akramcodez
Copy link
Contributor

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

  • Vertical Structure: Reorganized modal with clean top-to-bottom flow
  • Inline Question: Moved "Learn More" link to same line as question text
  • Right-aligned Controls: Positioned input field and submit button on the right side
  • Better Edit Flow: Instruction text now appears before input when editing existing goals

Typography & Styling

  • Larger Font Sizes: Increased input and button text from 12px to 14px for better readability
  • Consistent Spacing: Added proper gaps and padding throughout the modal
  • Enhanced Focus States: Improved input field focus indicators

Responsive Design

  • Mobile Optimization: Maintains horizontal layout on small screens with appropriate sizing
  • Consistent Experience: Same interaction patterns across all device sizes

Screenshots

Before

image image image

After

image image image

Copilot AI review requested due to automatic review settings October 9, 2025 08:40
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

There are accessibility issues in these changes.

<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>
Copy link

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines 63 to 67
&__submit-section {
// This section is no longer needed as button is moved to input section
display: none;
}

Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
&__submit-section {
// This section is no longer needed as button is moved to input section
display: none;
}

Copilot uses AI. Check for mistakes.

&__input-section {
gap: 12px;
flex-direction: row;
Copy link

Copilot AI Oct 9, 2025

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.

Suggested change
flex-direction: row;

Copilot uses AI. Check for mistakes.
@akramcodez
Copy link
Contributor Author

PTAL @jimchamp, thanks.

@jimchamp jimchamp self-assigned this Oct 9, 2025
@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Oct 10, 2025
@mekarpeles
Copy link
Member

@akramcodez the new designs look reasonable to us! We'll review the remaining issues shortly.

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

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:

Screenshot 2025-10-13 174911

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>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<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>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Comment on lines 26 to 28
&:hover {
text-decoration: underline;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this hover state? You didn't mention anything about this here.

Please remove this. The link is underlined to begin with.

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@akramcodez
Copy link
Contributor Author

@jimchamp added the changes. Sorry for the off-topic changes. Please let me know if there are any issues.

added a focus

before
Screenshot 2025-10-14 053800
after
Screenshot 2025-10-14 053824

@akramcodez akramcodez requested a review from jimchamp October 15, 2025 05:21
@akramcodez
Copy link
Contributor Author

@jimchamp if there’s any issue, please let me know

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

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 jimchamp added Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] and removed Needs: Response Issues which require feedback from lead labels Nov 4, 2025
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Nov 5, 2025
@akramcodez
Copy link
Contributor Author

akramcodez commented Nov 5, 2025

@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.
I’ve made some changes now and I think the Firefox small-screen overflow issue is also fixed. Please take a look and let me know if there are any issues.
If the focus indicator doesn’t look good, let me know I'll remove it from the code changes.
Screenshot 2025-11-05 105633
Screenshot 2025-11-05 105440
Screenshot 2025-11-05 105704
Screenshot 2025-11-05 105623

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Nov 5, 2025
Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't have hard-coded breakpoints. Please use one of these three

Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

@akramcodez
Copy link
Contributor Author

akramcodez commented Nov 6, 2025

@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.

image image

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

Thanks for your patience, @akramcodez!

@jimchamp jimchamp merged commit 12d140f into internetarchive:master Nov 11, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve "Yearly Reading Goal" Modal for Better Usability and Clarity

3 participants