fix(docs-infra): center copy button in code block header#69638
fix(docs-infra): center copy button in code block header#69638erkamyaman wants to merge 1 commit into
Conversation
|
It can be spotted here https://angular.dev/guide/directives/attribute-directives#building-an-attribute-directive |
|
Deployed adev-preview for dd67626 to: https://ng-dev-previews-fw--pr-angular-angular-69638-adev-prev-kvmcaffj.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
|
I had to draft it because I also noticed this #69030 also introduced this issue, fixing it all well together. Once it is done I will make the pr ready for review. |
dd67626 to
5c2abc0
Compare
The copy button in code block headers was misaligned, and the offset differed between header variants because the headers were not the same height. The filename (`h3`) header and the shorter prefer/avoid style header rendered at different heights, so a single `top` value could not center the button in both. Give every `.docs-code-header` a shared `min-height` (with `box-sizing: border-box` so the padding is not double-counted) and vertically center its contents, so all header variants render at the same height. The copy button's `top` is then a single value that centers it against every header.
5c2abc0 to
c31d5c9
Compare
|
The copy button was sitting a bit low, and how far off depended on the header type. Turns out #69030 put the button in the header with one hardcoded I just made all headers the same height to fix the issue, because otherwise a single Now one It can be spotted in https://angular.dev/guide/di/debugging-and-troubleshooting-di
|









The copy button in code block headers was misaligned, and the offset
differed between header variants because the headers were not the same
height. The filename (
h3) header and the shorter prefer/avoid styleheader rendered at different heights, so a single
topvalue could notcenter the button in both.
Give every
.docs-code-headera sharedmin-height(withbox-sizing: border-boxso the padding is not double-counted) and vertically centerits contents, so all header variants render at the same height. The copy
button's
topis then a single value that centers it against everyheader.
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
Does this PR introduce a breaking change?