refactor: split AffiliateLinks into AffiliateLinksLoadingIndicator.html for loading indicator#12687
Conversation
…ml for loading indicator
| </li> | ||
| </ul> | ||
| <small>$:_('When you buy books using these links the Internet Archive may earn a <a class="nostyle" href="/help/faq/about#selling">small commission</a>.')</small> | ||
| <ul class="buy-options-table"> |
There was a problem hiding this comment.
WCAG 1.3.1: <ul> contains direct text content. Wrap in <li>.
<ul> and <ol> must only contain <li>, <script>, or <template> as direct children.
Details
Screen readers announce list structure ('list with 5 items') based on proper markup. Placing non-<li> elements directly inside <ul> or <ol> breaks this structure. Wrap content in <li> elements, or if you need wrapper divs for styling, restructure your CSS to style the <li> elements directly.
for more information, see https://pre-commit.ci
|
Thank you for the pull request, @Sanket17052006! 🤖 Copilot has been assigned for an initial review. The linked issue (#12678) hasn't been triaged yet — triage happens on Mondays and Fridays. There are currently 71 open non-draft PRs ahead of yours. PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
There was a problem hiding this comment.
Pull request overview
This PR is phase 1 of #12678, splitting the affiliate-links UI into a dedicated loading-indicator macro and simplifying AffiliateLinks.html so it only renders the resolved “Buy this book” links (with async loading handled by JS + partials).
Changes:
- Added
AffiliateLinksLoadingIndicator.htmlmacro to render the “Fetching prices” spinner with the expectedaffiliate-links-sectiondata attributes. - Updated the edition view template to render the new loading-indicator macro instead of
AffiliateLinks(..., async_load=True). - Updated
AffiliateLinksPartialrendering to callAffiliateLinkswithout the removedasync_loadparameter.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| openlibrary/templates/type/edition/view.html | Switches initial render to the new loading-indicator macro for affiliate links. |
| openlibrary/plugins/openlibrary/partials.py | Removes async_load=False when rendering macros.AffiliateLinks in the partial. |
| openlibrary/macros/AffiliateLinksLoadingIndicator.html | Introduces a dedicated macro for the async loading spinner wrapper. |
| openlibrary/macros/AffiliateLinks.html | Removes the async_load parameter/branch so the macro always renders resolved links. |
Comments suppressed due to low confidence (1)
openlibrary/macros/AffiliateLinks.html:20
prices = opts.get('prices')is assigned but never used in this template, which adds noise and can mislead future refactors (especially now thatasync_loadis removed). Please remove the unused variable (or use it explicitly if it still has a purpose).
$code:
prices = opts.get('prices')
isbn = opts.get('isbn', '')
asin = opts.get('asin', '')
Part of #12678
This PR is the first phase of #12678 and splits and simplifies
AffiliateLinks.htmltemplate by moving the loading spineer toAffiliateLinksLoadingIndicator.htmlTechnical
Testing
http://localhost:8080/works/OL45310W/Robinson_Crusoe?edition=key:/books/OL24152177MScreenshot
Stakeholders
@RayBB