Comments (4)
@edwardhorsford screenshots might help explain this?
from nhsuk-frontend.
Here's a screenshot from my service. There's several h2s and a legend. The h2s get extra top padding when they follow a paragraph. However the legend (which should visually look like an h2) does not - this causes it to be too close to the proceeding paragraph.
from nhsuk-frontend.
It's probably tricky to extend the current SASS to cover fieldset legends and labels because there's so many different combinations (and they're not direct siblings). I asked ChatGPT and it suggested a refactor like this:
@mixin nhsuk-heading-padding($large-elements, $small-elements) {
@each $element in $large-elements {
.nhsuk-body-l + #{$element},
.nhsuk-body-m + #{$element},
.nhsuk-body-s + #{$element},
.nhsuk-list + #{$element},
.nhsuk-body-l + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-m + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-s + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-list + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-l + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-body-m + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-body-s + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-list + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element} {
@include nhsuk-responsive-padding(4, "top");
}
}
@each $element in $small-elements {
.nhsuk-body-l + #{$element},
.nhsuk-body-m + #{$element},
.nhsuk-body-s + #{$element},
.nhsuk-list + #{$element},
.nhsuk-body-l + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-m + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-s + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-list + .nhsuk-form-group > .nhsuk-label-wrapper > #{$element},
.nhsuk-body-l + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-body-m + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-body-s + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element},
.nhsuk-list + .nhsuk-form-group .nhsuk-fieldset > .nhsuk-fieldset__legend#{$element} {
padding-top: nhsuk-spacing(1);
@include mq($from: tablet) {
padding-top: nhsuk-spacing(2);
}
}
.nhsuk-lede-text + #{$element} {
padding-top: 0;
}
}
}
@include nhsuk-heading-padding(
('.nhsuk-heading-l', '.nhsuk-label--l', '.nhsuk-fieldset__legend--l'),
('.nhsuk-heading-m', '.nhsuk-heading-s', '.nhsuk-label--m', '.nhsuk-fieldset__legend--m')
);
We probably wouldn't want exactly this, but the refactor might be clearer.
from nhsuk-frontend.
Have also raised on GOVUK-Frontend.
from nhsuk-frontend.
Related Issues (20)
- Continue button auto focuses to wrong element on iOS 17 voiceover HOT 2
- Various elements do not meet AAA Enhanced target size HOT 1
- Footer copyright is not right aligned HOT 1
- Input prefix/suffix overflows containers with large font sizes HOT 2
- Action links rely on colour to convey meaning HOT 1
- Link vs body text colour contrast HOT 1
- Dashes in a Contents list have insufficient contrast HOT 1
- Ticks on checkboxes inside details element not rendering correctly HOT 1
- Improve line spacing on summary list
- Component JS files are only available in ESM syntax
- Missing style for nhsuk-list--border
- Allow copyright statement in footer to be set via Nunjucks macro HOT 1
- Error summaries should only be programatically focusable, not keyboard focusable HOT 1
- Label bottom margins are too large
- Order of imports affects styling for checkboxes and radio labels HOT 1
- Bug: inset text requires html option to be uppercase
- EPIC: Explore rebuilding NHS.UK frontend directly from GOV HOT 9
- Back links - probably shouldn't have visited colour styles when hovered. HOT 2
- Fix hashes and IDs for URLs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nhsuk-frontend.