-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove abbr tag from contents list link #3241
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- this page https://www.gov.uk/government/history/1-horse-guards-road calls the contents_list component and passes a series of links including one that includes an abbr (abbreviation) tag to explain the acronym 'GOGGS' - this acroynm is explained several times already in the text of the page, as well as in the contents list link that immediately precedes this one - there is no need for this tag inside this link, and this also causes significant complexity for the contents list component, which should not have anything other than text passed to it for the value of the text of a link
KludgeKML
approved these changes
Jun 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
andysellick
added a commit
to alphagov/govuk_publishing_components
that referenced
this pull request
Jun 28, 2024
- the contents list component does clever stuff when you pass the `format_numbers` option, where it identifies numbers at the start of the link text, splits the string into two, and wraps the number and text in separate spans so that the spacing between them can be controlled with CSS (otherwise 1. is misaligned with 10.) - in some circumstances the content arriving at the component has a non-breaking space instead of an actual space, i.e. "1. Text of link", which the component doesn't recognise and fails to split and wrap with spans for nice formatting, e.g. https://www.gov.uk/government/publications/financial-sanctions-guidance-for-russia/financial-sanctions-guidance-for-russia - this change allows for this situation and converts the non-breaking space into a regular space prior to formatted number checking - it also changes how the wrapped spans are returned (by now simply extracting the number and remaining text, wrapping them in spans and returning them) instead of a slightly more complex string replacing approach designed to preserve anything outside of the string - this includes refactoring the code and tests to simplify the code and limit the method to assume that the string passed to it should only be text, not markup, by stripping any HTML from the input - the helper spec in particular implied that markup (including a wrapping link) should be accepted by the method, but this is unrealistic - the output from the method is always wrapped in a parent (either a link or a span) and should not contain markup, as this is the text of the link, not a free area to inject HTML - this was being done in one place (to include an abbreviation tag inside the link) but has been corrected, see alphagov/government-frontend#3241
andysellick
added a commit
to alphagov/govuk_publishing_components
that referenced
this pull request
Jun 28, 2024
- the contents list component does clever stuff when you pass the `format_numbers` option, where it identifies numbers at the start of the link text, splits the string into two, and wraps the number and text in separate spans so that the spacing between them can be controlled with CSS (otherwise 1. is misaligned with 10.) - in some circumstances the content arriving at the component has a non-breaking space instead of an actual space, i.e. "1. Text of link", which the component doesn't recognise and fails to split and wrap with spans for nice formatting, e.g. https://www.gov.uk/government/publications/financial-sanctions-guidance-for-russia/financial-sanctions-guidance-for-russia - this change allows for this situation and converts the non-breaking space into a regular space prior to formatted number checking - it also changes how the wrapped spans are returned (by now simply extracting the number and remaining text, wrapping them in spans and returning them) instead of a slightly more complex string replacing approach designed to preserve anything outside of the string - this includes refactoring the code and tests to simplify the code and limit the method to assume that the string passed to it should only be text, not markup, by stripping any HTML from the input - the helper spec in particular implied that markup (including a wrapping link) should be accepted by the method, but this is unrealistic - the output from the method is always wrapped in a parent (either a link or a span) and should not contain markup, as this is the text of the link, not a free area to inject HTML - this was being done in one place (to include an abbreviation tag inside the link) but has been corrected, see alphagov/government-frontend#3241
andysellick
added a commit
to alphagov/govuk_publishing_components
that referenced
this pull request
Jul 1, 2024
- the contents list component does clever stuff when you pass the `format_numbers` option, where it identifies numbers at the start of the link text, splits the string into two, and wraps the number and text in separate spans so that the spacing between them can be controlled with CSS (otherwise 1. is misaligned with 10.) - in some circumstances the content arriving at the component has a non-breaking space instead of an actual space, i.e. "1. Text of link", which the component doesn't recognise and fails to split and wrap with spans for nice formatting, e.g. https://www.gov.uk/government/publications/financial-sanctions-guidance-for-russia/financial-sanctions-guidance-for-russia - this change allows for this situation and converts the non-breaking space into a regular space prior to formatted number checking - it also changes how the wrapped spans are returned (by now simply extracting the number and remaining text, wrapping them in spans and returning them) instead of a slightly more complex string replacing approach designed to preserve anything outside of the string - this includes refactoring the code and tests to simplify the code and limit the method to assume that the string passed to it should only be text, not markup, by stripping any HTML from the input - the helper spec in particular implied that markup (including a wrapping link) should be accepted by the method, but this is unrealistic - the output from the method is always wrapped in a parent (either a link or a span) and should not contain markup, as this is the text of the link, not a free area to inject HTML - this was being done in one place (to include an abbreviation tag inside the link) but has been corrected, see alphagov/government-frontend#3241
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What / why
Visual changes