Repository navigation
docs: scale content images to the column width on narrow screens - #3298
Open
ngocanhnckh wants to merge 1 commit into
Open
ngocanhnckh wants to merge 1 commit into
ngocanhnckh wants to merge 1 commit into
Conversation
The two 660px figures on the home page had no max-width, so the page scrolled sideways on phones and on windows narrower than about 1000px.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is broken
On the docs site home page (https://microsoft.github.io/TypeAgent/) the two 660px figures (
TypeAgent-Body1-*.gif,TypeAgent-Body2-*.gif) have nomax-width. The stylesheet has noimgrule, so they keep their natural width and stick out of the content column. The page is 680px wide at every viewport from 320 to 767px (about 305px of the first figure is off-screen at 375px), so phones scroll sideways. It also happens between 768 and about 990px, where the sidebar leaves less than 660px for the content: at 820px the page is 970px wide.Cause
docs/assets/css/style.csshas no rule limiting images to their container.Fix
Scoped to the docs content column, so the header and footer are untouched.
height: autokeeps the aspect ratio. Widths of 1024px and above are unchanged because the column is already 660px or wider there.Testing
Built and served with
cd docs && npm install && npx eleventy --serve, then measureddocument.documentElement.scrollWidthwith Playwright.The red marks in the before shots point at the broken part.
The site has no dark theme.
I found this with renderlint, an open-source CLI I maintain that renders pages in a headless browser and reports layout defects. It flags the two images as
viewport-overflow(360px beyond a 320px viewport) before the change and reports no layout findings after it. If it would be useful, I'm happy to open a follow-up PR that runs it on the docs in CI; no pressure either way.