govuk-frontend icon indicating copy to clipboard operation
govuk-frontend copied to clipboard

Add parameter to localise mobile menu toggle button

Open domoscargin opened this issue 2 years ago • 7 comments

Adds the menuButtonText parameter to customise the text of the menu toggle button that appears on narrow screens.

Cherry picked this from @querkmachine's spike [#2614] as the minimum changes required.

Fixes #1904

domoscargin avatar Jul 21 '22 11:07 domoscargin

HTML?

We've allowed for text replacement. I can't immediately think of any good reason to allow for HTML here - there may be an aspect of the i18n work I'm missing though?

I'd suggest using menuButtonText so that if we need to introduce the HTML option in the future we can do so whilst being consistent with the other options and components.

(Also works if we find we need to add e.g. menuButtonClasses or menuButtonAttributes)

36degrees avatar Jul 21 '22 12:07 36degrees

In my redo of the footer parameters I did end up changing them from taking strings to following the whole html/text separation, as it let me merge some related parameters (like copyright link, image toggles) into the options.

I agree with @domoscargin that being able to set HTML here probably isn't needed. The main counterpoint I can think of is a situation where a language may have quite a long word(s) for navigation menu, so they opt to abbreviate it but then want a title/aria-label/visually-hidden text to expand upon it.

querkmachine avatar Jul 22 '22 10:07 querkmachine

Just noticed we now have a navigationLabel and a menuButtonText that In most cases I suspect should be the same, and both default to 'Menu'. Suspect the navigationLabel might easily be missed when translating as it's not visible text.

Wondering if it might make sense to make navigationLabel default to whatever menuButtonText is, so that they stay in sync unless someone intentionally sets navigationLabel to something different? 🤔

36degrees avatar Jul 22 '22 10:07 36degrees

@36degrees, I've defaulted navigationLabel to menuButtonText.

I've also had a go at writing a changelog entry, but it feels a bit meh to just say "don't make it too long". Do we have any character length restrictions on other parameters?

domoscargin avatar Jul 27 '22 13:07 domoscargin

I'm thinking it'd be enough documentation-wise to edit the header.yaml menuButtonText description to something like:

Text for the button that toggles the navigation. This should be [the shortest useful text that describes the button's purpose][a maximum of 30 characters]. Defaults to 'Menu'.

domoscargin avatar Jul 27 '22 20:07 domoscargin

To parrot what I've already said on Slack, for the permanent record:

I’m not sure of what guidance should go with this. There is a limit, but the limit is a visual one—you can’t really describe it as ‘max n characters’, especially in a localisation context

It’s heavily dependent on the width of the device too. If we use 320px as a baseline then you have a decent amount of space, at least.

querkmachine avatar Aug 02 '22 09:08 querkmachine

@christopherthomasdesign What do you think? Does this require more design work? Or will some kind of guidance do?

domoscargin avatar Aug 10 '22 08:08 domoscargin

@christopherthomasdesign What do you think? Does this require more design work? Or will some kind of guidance do?

I don't think so, long as we make it clear this is specifically to accommodate different languages. There seems to be enough space for a long-ish word to go alongside the logo. We just want to make sure users check the word they use still looks ok on smaller screens and at different zoom levels.

christopherthomasdesign avatar Aug 12 '22 08:08 christopherthomasdesign

Moved the changelog entry as it was in the wrong location now that 4.3.1 has released.

querkmachine avatar Aug 18 '22 15:08 querkmachine