Skip to content
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

Add visual cue for when a dialog is available #753

Closed
wants to merge 2 commits into from

Conversation

owenatgov
Copy link
Contributor

@owenatgov owenatgov commented Oct 8, 2024

Change

Adds visual cues to the component so that users who are zoomed into the input know that there is a dialog below that they may be able to interact with. When a dialog is displayed, the input will be given a 'bottomless' class to remove it's bottom border, making it visually flow into the menu and drawing the eye down.

This also gates the change behind the useBottomlessInput attribute so that users using the cssNamespace attribute doesn't get served useless CSS classes on render.

More detail in alphagov/govuk-design-system#4015

Visual changes

Before/without attribute

Autocomplete with open menu before change

After

Autocomplete with open menu after change

Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for accessible-autocomplete ready!

Name Link
🔨 Latest commit e1964d5
🔍 Latest deploy log https://app.netlify.com/sites/accessible-autocomplete/deploys/6706a7179ca42b00087e2946
😎 Deploy Preview https://deploy-preview-753--accessible-autocomplete.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@owenatgov owenatgov force-pushed the visual-cue-when-there-are-results branch from 6ef1829 to f00d4d0 Compare October 8, 2024 11:41
@owenatgov owenatgov marked this pull request as ready for review October 8, 2024 11:42
@owenatgov owenatgov requested a review from a team October 8, 2024 11:42
@owenatgov owenatgov force-pushed the visual-cue-when-there-are-results branch 3 times, most recently from f0b1335 to dcaf136 Compare October 8, 2024 12:05
@edwardhorsford
Copy link
Contributor

edwardhorsford commented Oct 8, 2024

@owenatgov I would encourage significant usability testing on this before showing arrow by default.

The risk is that it nudges people towards interacting with the results prematurely so they end up interacting with a long list rather than a much shorter filtered list.

I've observed this across many usability sessions - that when the arrow is present, users stop interacting with the autocomplete as an autocomplete - they don't type or search but instead click the arrow to use it as a select. This might be mitigated if the arrow is only shown once there's results, but I'd still want to test it extensively.

On my previous service we initially used the showAllValues option but eventually removed it because in practice it made searching for items worse.

Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple of questions on the code changes, but couldn't check how things were working as Netlify seems to be struggling to deploy. From the screenshots, the arrow looks quite high inside the input box, though, is this intended?

src/autocomplete.css Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
test/integration/index.js Outdated Show resolved Hide resolved
src/autocomplete.js Outdated Show resolved Hide resolved
@owenatgov
Copy link
Contributor Author

@edwardhorsford This is useful context, cheers. To clarify, the arrow is only shown when there are results. I've tried to adjust the content of the PR to make that clearer.

@edwardhorsford
Copy link
Contributor

@edwardhorsford This is useful context, cheers. To clarify, the arrow is only shown when there are results. I've tried to adjust the content of the PR to make that clearer.

Thanks, I understand that - I'd still be cautious with this change and encourage usability testing of it first to make sure the downsides I mentioned don't occur.

@owenatgov
Copy link
Contributor Author

After discussing this again with the team, we're going to remove the arrow following @edwardhorsford's comments about prior research. We think the 'bottomless' effect is good enough (pending testing by @selfthinker). I'm going to remove the arrow and adjust the description of this PR.

@edwardhorsford
Copy link
Contributor

Thanks @owenatgov - I didn't comment on the line but it looks like a nice visual touch!

It may well be there's no impact from the arrow, or another visual indicator could be added that doesn't look like a arrow / select.

@owenatgov owenatgov force-pushed the visual-cue-when-there-are-results branch from dcaf136 to 271a8b3 Compare October 9, 2024 15:44
Adds a `bottomless` class to the input that removes the bottom border and activates when a dialog is displayed and a top 'border' to visually separate input and dialog
@owenatgov owenatgov force-pushed the visual-cue-when-there-are-results branch from 271a8b3 to e9bd979 Compare October 9, 2024 15:51
This gates the feature behind a component attribute so that users of the `cssNamespace` attribute don't get served extra useless classes on component render.
@owenatgov
Copy link
Contributor Author

I've added an attribute to this PR: useBottomlessInput. This gates this process behind an attribute to prevent us service useless CSS classes to users of cssNamespace. This is following suggestions by Romaric on this PR and discussions off github that this could be a breaking change.

Now that I've done it I'm not sure how necessary this is. The component won't stop working, it'll just not use the visual enhancement and we service them extra html in the form of additional CSS classes. I'm not sure this is breaking necessarily. The 'breaking' point felt much more relevant when we still had the arrow since the way I'd done it made it more likely to be a breaking change. @romaricpascal Whatcha reckon?

@selfthinker
Copy link

I have tested the old and new version in Windows High Contrast Mode (option 1, 2 and white), Firefox colour changes (a dark and a light colour scheme) and the Chrome extension 'High Contrast'.
I have uploaded screenshots of everything to this folder (which can only be viewed internally).

To summarise those:
I guess the difference is clear enough when none of the results has been selected yet. But when the first item has been selected (as is the case automatically on the Design System website), the difference is much less visible.
In Firefox the dropdown never looks like an extension of the text field because their background colours are different.

The dropdown box never aligns with the text field. That has nothing to do with this change, though.
It's also interesting that the highlighted item always has blue as a background colour. While that also doesn't have anything to do with this change, it might be more important to help with the perception that the dropdown extends the text field. There might be a problem with how we set the colour. Could we maybe use the system colour 'Highlight' in forced colour modes?

@owenatgov
Copy link
Contributor Author

Following a chat off-github with @romaricpascal I'm going to close this in favour of alphagov/govuk-design-system#4220. Reasons:

If this turns out to be useful for users who aren't styling their own autocompletes, we may reopen or restart this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants