GithubHelp home page GithubHelp logo

Comments (7)

peteryates avatar peteryates commented on September 12, 2024 1

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.

aliuk2012 avatar aliuk2012 commented on September 12, 2024

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.

aliuk2012 avatar aliuk2012 commented on September 12, 2024

The caption could include visually hidden content for screenreader users too

from govuk-formbuilder.

peteryates avatar peteryates commented on September 12, 2024

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.

aliuk2012 avatar aliuk2012 commented on September 12, 2024

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.

peteryates avatar peteryates commented on September 12, 2024

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.

aliuk2012 avatar aliuk2012 commented on September 12, 2024

That sounds a good approach 👍

from govuk-formbuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.