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

Replace trip sort select with accessible dropdown #897

Merged
merged 12 commits into from
Jun 5, 2023

Conversation

amy-corson-ibigroup
Copy link
Contributor

Description:

Select to sort trip results updates page without warning (3.2.2 On Input). This PR repurposes the locale selector dropdown to provide a better approach to sorting in terms of accessibility.

PR Checklist:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?
Before After
image image

Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

I think it is heading in the right direction. I would create s separate styled component for the locale selector (so that you don't have to pass that extra locale prop. I also indicated some i18n and a11y tweaks too.

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/util/dropdown.tsx Outdated Show resolved Hide resolved
lib/components/util/dropdown.tsx Outdated Show resolved Hide resolved
lib/components/util/dropdown.tsx Outdated Show resolved Hide resolved
lib/components/util/sortOptions.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

One major change! I don't think this behavior should be the default

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
@miles-grant-ibigroup miles-grant-ibigroup removed their assignment May 15, 2023
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Please see the tweaks mentioned, I think that'll make things much cleaner.

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/util/dropdown.tsx Outdated Show resolved Hide resolved
lib/components/util/sortOptions.ts Outdated Show resolved Hide resolved
@binh-dam-ibigroup binh-dam-ibigroup removed their assignment May 18, 2023
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Chef's kiss. Much cleaner!

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
/>
</span>
}
nav
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just remove the unused nav prop.

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Very clever re-use of components and great cleanup!

I have a few cosmetic notes before I dig into the code -- I'm sad to see the locale selector dropdown has lost its background on click. I would be sad to lose it but if it's not possible to keep then I think it's worth it based on how good the new dropdown looks!

The second thing is that because the dropdown is now non-native the leave feedback button that's sometimes to the left of it looks very out of place. Do you think it's worth creating a matching button class?

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

A few more bugs to iron out

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
lib/components/util/dropdown.tsx Show resolved Hide resolved
lib/components/app/locale-selector.tsx Show resolved Hide resolved
Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

I'm not sure if this was introduced by this PR but still seeing some problems using arrow keys to navigate the menu. Agreed we can deal with the rough edges in a future PR. Should be ready to go once merge conflicts are sorted

lib/components/util/dropdown.tsx Outdated Show resolved Hide resolved
@amy-corson-ibigroup
Copy link
Contributor Author

Fixed merge conflicts! I am not seeing any issues with the keyboard navigation on the dropdown, can you let me know if you still are?

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Keyboard navigation isn't working for the leave feedback button or the profile log in button! The color of the login button also looks off on mobile:
Screenshot 2023-05-26 at 7 20 57 PM

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Code is looking so much cleaner this is fantastic thank you so much!

Only 1 last case that's having problems and that's a browser window that's really slim, but not a mobile browser:
Screenshot 2023-06-01 at 8 33 35 AM

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Great work! Just 2 tiny nitpicks

Comment on lines +31 to +37
const NavItemOnLargeScreens = styled(NavbarItem)`
display: block;
@media (max-width: 768px) {
display: none !important;
}
`

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that we control NavbarItem we can probably add this rule right to NavbarItem! This hack was only there because I couldn't touch bootstrap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're using NavbarItem for the log in/sign up button as well, which should stay visible at smaller screen sizes, so I think the custom rule is still necessary!

lib/components/narrative/narrative-itineraries-header.tsx Outdated Show resolved Hide resolved
@amy-corson-ibigroup amy-corson-ibigroup merged commit ecb59c1 into dev Jun 5, 2023
@amy-corson-ibigroup
Copy link
Contributor Author

Thank you both for all the help with this one!

@amy-corson-ibigroup amy-corson-ibigroup deleted the results-sort-dropdown branch June 5, 2023 16:12
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.

3 participants