Repository navigation
Keep the API Copy page menu on screen on phones #4965
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 all commits
66f7e74
f1b7508
914f379
33620e4
5acd4ec
8da9deb
f03e04c
a48578e
0f3b1f8
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 |
|---|---|---|
| @@ -1,15 +1,14 @@ | ||
| @inherits RazorSlice<Elastic.Documentation.Site.ApiSpecDownload> | ||
| @* For a page with no Markdown export, so no Copy page: the spec download is the whole menu. *@ | ||
| <div class="api-page-actions" role="group" aria-label="Page actions"> | ||
| @* For a page with no Markdown export, so no Copy page: the spec download is the whole menu. Like Copy page's, the menu | ||
| is a popover placed beside its button by floating.ts. Without popover support the links show inline (api-docs.css). *@ | ||
| <div class="api-page-actions api-page-actions--download-only" role="group" aria-label="Page actions"> | ||
| <div class="api-page-actions-split"> | ||
| <details class="api-page-actions-dropdown nav-select-dropdown"> | ||
| <summary class="api-page-actions-chevron api-page-actions-chevron--labeled" aria-haspopup="menu"> | ||
| @await RenderPartialAsync(_DownloadIcon.Create()) | ||
| <span class="api-page-actions-label">Download spec</span> | ||
| </summary> | ||
| <div class="api-page-actions-menu" role="menu"> | ||
| @await RenderPartialAsync(_SpecDownloadLinks.Create(Model)) | ||
| </div> | ||
| </details> | ||
| <button type="button" class="api-page-actions-chevron api-page-actions-chevron--labeled" popovertarget="api-page-actions-menu" aria-haspopup="menu" aria-expanded="false"> | ||
| @await RenderPartialAsync(_DownloadIcon.Create()) | ||
| <span class="api-page-actions-label">Download spec</span> | ||
| </button> | ||
| </div> | ||
| <div id="api-page-actions-menu" class="api-page-actions-menu" role="menu" popover data-placement="bottom-end"> | ||
| @await RenderPartialAsync(_SpecDownloadLinks.Create(Model)) | ||
| </div> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,10 +247,9 @@ | |
| padding: 0; | ||
| border-left: 1px solid #cad3e2; | ||
| border-radius: 0 7px 7px 0; | ||
| list-style: none; | ||
| } | ||
|
|
||
| /* No Copy page beside it, so the summary is the whole control. */ | ||
| /* No Copy page beside it, so the button is the whole control. */ | ||
| .api-page-actions-chevron--labeled { | ||
| width: auto; | ||
| gap: 8px; | ||
|
|
@@ -260,10 +259,6 @@ | |
| white-space: nowrap; | ||
| } | ||
|
|
||
| .api-page-actions-chevron::-webkit-details-marker { | ||
| display: none; | ||
| } | ||
|
|
||
| .api-page-actions-button:hover, | ||
| .api-page-actions-chevron:hover { | ||
| background: #f6f9fc; | ||
|
|
@@ -292,28 +287,28 @@ | |
| height: 12px; | ||
| } | ||
|
|
||
| .api-page-actions details.api-page-actions-dropdown, | ||
| .api-page-actions details.nav-select-dropdown { | ||
| position: relative; | ||
| display: flex; | ||
| width: auto; | ||
| overflow: visible; | ||
| .api-page-actions-chevron[aria-expanded='true'] .api-page-actions-chevron-icon { | ||
| transform: rotate(180deg); | ||
| } | ||
|
|
||
| .api-page-actions-dropdown[open] .api-page-actions-chevron-icon, | ||
| .api-page-actions-dropdown.is-open .api-page-actions-chevron-icon { | ||
| transform: rotate(180deg); | ||
| /* Without the Popover API (floating.css hides the menu) the download-only page has nothing else on it, so its links show inline in place of the button. */ | ||
| @supports not selector(:popover-open) { | ||
|
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. Severity: P3 (Low) The updated snapshot verifies the modifier class, but it cannot catch a CSS regression that hides both download links when popovers are unsupported. Add a browser-level check for the download-only fallback that verifies the trigger is hidden and both links remain visible. Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
Member
Author
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. No new test, but I ran the check you describe against the shipped CSS in Chrome. I took every rule from the built 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. I don’t think a bespoke test setup is warranted for this low-severity fallback. Your check is useful evidence that the current rules produce the intended result: the download-only split control is hidden while its menu is displayed under the Generated by Libra. React with 👍 or 👎 to give feedback on this comment. |
||
| .api-page-actions--download-only .api-page-actions-split { | ||
| display: none; | ||
| } | ||
| .api-page-actions--download-only .api-page-actions-menu { | ||
| display: block; | ||
| } | ||
| } | ||
|
|
||
| /* A popover placed beside the chevron by floating.ts (floating.css). */ | ||
| .api-page-actions-menu { | ||
| box-sizing: border-box; | ||
| position: absolute; | ||
| top: calc(100% + 6px); | ||
| right: 0; | ||
| z-index: 40; | ||
| width: max-content; | ||
| min-width: 196px; | ||
| margin: 0; | ||
| max-width: calc(100vw - 16px); | ||
| max-height: var(--floating-available-height, none); | ||
| overflow-y: auto; | ||
| padding: 8px; | ||
| background: #fff; | ||
| border: 0; | ||
|
|
@@ -3823,12 +3818,12 @@ html:has(.api-page-shell) { | |
| fill: currentColor; | ||
| } | ||
|
|
||
| /* Positioned from the "more" button in api-examples-carousel.ts; the popover UA styles centre it otherwise. */ | ||
| /* A popover placed under the "more" button, or the row's search box, by floating.ts (floating.css). */ | ||
| .api-example-menu { | ||
| box-sizing: border-box; | ||
| width: max-content; | ||
| max-width: min(320px, calc(100vw - 16px)); | ||
| max-height: min(320px, 50vh); | ||
| max-height: min(320px, 50vh, var(--floating-available-height, 100vh)); | ||
| margin: 0; | ||
| padding: 4px; | ||
| overflow: auto; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.