Problem
On the book edition/view pages, the "Download catalog record" bar (RDF / JSON / OPDS | Wikipedia citation) overflows its parent container #contentBody. This occurs because the bar is styled using .pageHistory__tools which has float: right, but the parent container does not clear the floated element. This causes the element to hang outside the visual border of the white container area, bleeding into the gray background/margin area.
We have explored and verified two clean approaches to resolve this, both of which render beautifully and are fully responsive:
Approach 1: Clearfix with Semantic Margin-Bottom offset (Recommended)
Since the lib/exports template is floated, we can clear the float in the parent template openlibrary/templates/type/edition/view.html immediately after rendering the tools. To prevent the clearfix from creating too much empty space due to container padding, we use a negative margin calculated semantically from the container's padding custom variable:
$:render_template("lib/exports", page)
<div class="clearfix" style="margin-bottom: calc(-1 * var(--contentBody-padding));"></div>
Approach 2: Redefining Floated Tool Padding
Alternatively, we can adjust the top padding of the floated tools class .pageHistory__tools inside static/css/components/page-history.css from 8px to 3px. This shifts the element slightly up so that it aligns nicely within the parent container's padding:
.pageHistory__tools {
font-size: 0.7em;
float: right;
padding-top: 3px;
}
Both of these approaches successfully contain the element within the white boundaries of #contentBody across all standard viewport widths (desktop, tablet, and mobile), avoiding any container overflow or text-clipping.
- Relevant URL: Any book/edition page, e.g.
https://openlibrary.org/books/OL24620876M/Responsive_Web_Design
- Screenshots:
Reproducing the bug
- Go to any book/edition detail page (e.g.,
https://openlibrary.org/books/OL24620876M/Responsive_Web_Design).
- Scroll to the very bottom of the book's details container.
- Observe the "Download catalog record: RDF / JSON / OPDS | Wikipedia citation" line.
- Expected behavior: The download tools bar should be cleanly contained within the main content body's background and padding.
- Actual behavior: The text overflows past the bottom padding of the content body container, hanging outside the boundary line.
Context
- Browser (Chrome, Safari, Firefox, etc): Chrome
- OS (Windows, Mac, etc): Windows
- Logged in (Y/N): Y
- Environment (prod, dev, local): all
Breakdown
Implementation Details (for maintainers)
Requirements Checklist
Related files
Stakeholders
Instructions for Contributors
- Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Problem
On the book edition/view pages, the "Download catalog record" bar (RDF / JSON / OPDS | Wikipedia citation) overflows its parent container
#contentBody. This occurs because the bar is styled using.pageHistory__toolswhich hasfloat: right, but the parent container does not clear the floated element. This causes the element to hang outside the visual border of the white container area, bleeding into the gray background/margin area.We have explored and verified two clean approaches to resolve this, both of which render beautifully and are fully responsive:
Approach 1: Clearfix with Semantic Margin-Bottom offset (Recommended)
Since the
lib/exportstemplate is floated, we can clear the float in the parent templateopenlibrary/templates/type/edition/view.htmlimmediately after rendering the tools. To prevent the clearfix from creating too much empty space due to container padding, we use a negative margin calculated semantically from the container's padding custom variable:$:render_template("lib/exports", page) <div class="clearfix" style="margin-bottom: calc(-1 * var(--contentBody-padding));"></div>Approach 2: Redefining Floated Tool Padding
Alternatively, we can adjust the top padding of the floated tools class
.pageHistory__toolsinsidestatic/css/components/page-history.cssfrom8pxto3px. This shifts the element slightly up so that it aligns nicely within the parent container's padding:Both of these approaches successfully contain the element within the white boundaries of
#contentBodyacross all standard viewport widths (desktop, tablet, and mobile), avoiding any container overflow or text-clipping.https://openlibrary.org/books/OL24620876M/Responsive_Web_DesignReproducing the bug
https://openlibrary.org/books/OL24620876M/Responsive_Web_Design).Context
Breakdown
Implementation Details (for maintainers)
Requirements Checklist
Related files
Stakeholders
Instructions for Contributors