Comments (7)
Good call, I'll add this to the legend
and label
options, probably in the following format:
= form.govuk_text_field(:number_of_places,
label: {
text: "How many places would you like to request?",
size: "xl",
tag: "h1",
caption: @training_provider.provider_name
},
pattern: "[0-9]*",
inputmode: "numeric",
width: 10) do
from govuk-formbuilder.
Is it worth adding a caption_position
which would accept either inside
or outside
which would control the positioning of the caption?
from govuk-formbuilder.
The caption could include visually hidden content for screenreader users too
from govuk-formbuilder.
If it's meant to be outside wouldn't just manually placing the caption outside work?
span.govuk-caption = @training_provider.provider_name
= form.govuk_text_field(:number_of_places, ...)
With regards to visually hidden captions I'd be inclined to let them be configured manually (and left outside the helper) too. There's no reference to hiding them in the design system docs.
from govuk-formbuilder.
I suppose placing the caption outside like I have already done would work, it just means that the page would look like the screenshot above with the caption not being included in the error form group.
I know the design system doesn't mention it but I've seen services where extra visually hidden content is included.
Eg.
<span class="govuk-caption-xl">
<span class="govuk-visually-hidden">You are currently viewing </span>
<%= provider_name %>
</span>
Eg.
<span class="govuk-caption-xl">
<%= provider_name %><span class="govuk-visually-hidden">:</span>
</span>
<h1>Location</h1>
from govuk-formbuilder.
I suppose placing the caption outside like I have already done would work, it just means that the page would look like the screenshot above with the caption not being included in the error form group.
Ah, I see what you mean now, inside or outside the tag
, not the .form-group
. Makes sense.
I think this could be solved entirely by allowing legend to take a proc rather than a hash, similar to how it works on #govuk_collection_radio_buttons
. That would keep the API simple but allow full customisation of the contents of <legend>
.
from govuk-formbuilder.
That sounds a good approach
from govuk-formbuilder.
Related Issues (20)
- Date Handling Errors HOT 6
- Displaying all errors for child attributes HOT 2
- Not able to check a govuk_radio_button value HOT 5
- govuk_submit should output a button instead of an input HOT 5
- Use input=date HOT 2
- It's not possible to make radio labels a regular font weight when a hint is provided HOT 1
- Setting a JSON object as an HTML attribute on form elements doesn't work HOT 1
- Idea: let hint text for date fields contain dynamic dates HOT 1
- HTML safe markup is ignored even when providing a custom presenter HOT 1
- Change hint element to div instead of span tag HOT 1
- Remove `pattern` attribute from date field
- Conditional revealed question values HOT 4
- Support hint for fieldset HOT 3
- Labels in radio button collections that include hint text are unexpectedly emboldened
- Possible improvement: localisation of nested attributes HOT 6
- Hrefs on `.govuk-error-summary__list` item links do not match IDs on `.govuk-error-message` elements HOT 2
- Can we release a patch version that supports the latest version of Pagy?
- Select does not show errors from Rails' belongs_to presence validation HOT 5
- Version 4.0.0
- Support inverse button style HOT 2
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 govuk-formbuilder.