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

feat: Add hover states to bookmarks #987

Merged
merged 37 commits into from
Apr 21, 2023
Merged

Conversation

jcbcapps
Copy link
Contributor

@jcbcapps jcbcapps commented Apr 11, 2023

SC-1568

Proposed changes

  • A user hovers over a bookmark and an icon appears (if the bookmark has a description)
  • A user hovers over the icon and can see a description of the bookmark
  • Refactor of bookmark types - name change and clearer definition of fields
  • Refactor mock data for bookmarks
  • Remove getMySpace query from /sites-and-applications page (forgot to do this in refactor: Refactor MySpace component #978)

Still to do:

  • Fix tests

Reviewer notes

Run the app and

  • Test the new hover feature, verify that the icon appears only for bookmarks with a description
  • Also since I refactored the bookmark types and had to change around some components, test anything you can think of related to bookmarks: adding, editing, drag-and-drop, etc.
  • Navigate to /sites-and-applications and verify that everything there works as expected (since I removed the getMySpace query)

Please give the e2e test a look as well: https://github.com/USSF-ORBIT/ussf-portal/pull/262

Setup

yarn services:up && yarn dev in CMS
yarn dev in portal


Code review steps

As the original developer, I have

  • Met the acceptance criteria, or will meet them in subsequent PRs or stories
    • ...
  • Created new stories in Storybook if applicable
    • Checked that all Storybook accessibility checks are passing
  • Created/modified automated unit tests in Jest
    • Including jest-axe checks when UI changes
  • Created/modified automated E2E tests in Cypress
    • Including cypress-axe checks when UI changes
    • Checked that the E2E test build is not failing
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)
  • Requested a design review for user-facing changes
  • For any new migrations/schema changes:
    • Followed guidelines for zero-downtime deploys

As code reviewer(s), I have

  • Pulled this branch locally and tested it
  • Reviewed this code and left comments
  • Checked that all code is adequately covered by tests
    • Checked that the E2E test build is not failing
  • Made it clear which comments need to be addressed before this work is merged
  • Considered marking this as accepted even if there are small changes needed
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)

As a designer reviewer, I have

  • Checked in the design translated visually
  • Checked behavior
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links
  • Tried to break the intended flow
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)

As a test user, I have

  • Run through the Test Script:
    • On commercial internet in IE11
    • On commercial internet in Firefox
    • On commercial internet in Chrome
    • On commercial internet in Safari
    • On NIPR in IE11
    • On NIPR in Firefox
    • On NIPR in Chrome
    • On NIPR in Safari
    • On a mobile device in Firefox
    • On a mobile device in Chrome
    • On a mobile device in Safari
  • Added any anomalous behavior to this PR

Screenshots

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #1568: Add hover states to bookmarks.

Comment on lines +64 to +76
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM11 15H9V9H11V15ZM11 7H9V5H11V7Z"
fill="currentColor"
/>
</svg>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this inline because we can change the fill value to currentColor and then control the color with CSS, as opposed to having to add a second icon for dark theme.

@jcbcapps jcbcapps changed the title WIP: Add hover states to bookmarks feat: Add hover states to bookmarks Apr 17, 2023
@jcbcapps jcbcapps marked this pull request as ready for review April 17, 2023 16:02
@jcbcapps jcbcapps requested review from a team as code owners April 17, 2023 16:02
@shkeating
Copy link
Contributor

the info icon is not currently available to keyboard users

@@ -63,8 +63,8 @@ const Error: NextPageWithLayout<Props> = ({ statusCode }: Props) => {
)
}

Error.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this is slick, it's not very intuitive. I rearranged it to be a little easier on the eyes.

Comment on lines +390 to +392
{visibleBookmarks.map((bookmark: MongoBookmark, index) => {
const foundBookmark = findBookmark(bookmark)
return bookmark.cmsId && foundBookmark ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted to add this check for an undefined bookmark here so that we could maintain the new and improved type-safe RemovableBookmark component. So now if there is some misalignment between cmsId and id it will just display as a CustomBookmark


/* MongoBookmark refers to an existing bookmark as it is stored in MongoDB. This includes
both user-created bookmarks and bookmarks that the user has added from the CMS. */
export type MongoBookmark = {
Copy link
Contributor

@abbyoung abbyoung Apr 18, 2023

Choose a reason for hiding this comment

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

I know we had briefly talked in eng sync about naming for this, MongoBookmark vs UserBookmark vs < something else >. @gidjin did you have a preference or strong opinions?

Copy link
Contributor

Choose a reason for hiding this comment

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

My preference is for UserBookmark but I'm okay if it stays this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left it as MongoBookmark because, since we have bookmarks coming from two different places, it makes it more clear when working with a bookmark where it's coming from. Happy to change it if the need arises, but thought I'd clarify my intentions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm good with that reasoning. Thanks for noting it!

Copy link
Contributor

@abbyoung abbyoung left a comment

Choose a reason for hiding this comment

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

LGTM! Works as expected. A question around naming but it isn't a blocker for me.

One question for potential follow-up story: Should the hover/tooltip also show on Sites & Apps in the collection view?

Copy link
Contributor

@malworks malworks left a comment

Choose a reason for hiding this comment

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

Looks great on the myspace page! I don't see it on the sites&applications page though, can we put them there too?

Edit: Oh Abigail beat me to it!

Comment on lines +148 to 152
url: bookmark.url,
label: bookmark.label,
collectionId,
cmsId: bookmark.id,
...bookmark,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

@jcbcapps this is one of the areas that was causing the test to fail, turned out after the fix of the types we were sending too much information to the bookmark. Thanks to @abbyoung for finding it.


/* MongoBookmark refers to an existing bookmark as it is stored in MongoDB. This includes
both user-created bookmarks and bookmarks that the user has added from the CMS. */
export type MongoBookmark = {
Copy link
Contributor

Choose a reason for hiding this comment

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

My preference is for UserBookmark but I'm okay if it stays this way.

Comment on lines -442 to -445
expect(screen.getByText('3 collections selected')).toBeInTheDocument()
expect(
screen.getByText('(0 of 25 possible remaining)')
).toBeInTheDocument()
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Did you intend to remove all the checks around the max # of collections or was that inadvertent?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should add this back, I'm going to do that today.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked and this is covered just differently than before. I added a couple checks but I understand the test better now.

@abbyoung abbyoung requested review from a team April 20, 2023 18:05
Copy link
Contributor

@gidjin gidjin left a comment

Choose a reason for hiding this comment

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

Marking request for changes since I want to add the tests I flagged back.

@gidjin gidjin requested review from abbyoung and malworks April 20, 2023 21:18
Copy link
Contributor

@abbyoung abbyoung left a comment

Choose a reason for hiding this comment

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

Re-reviewed with bookmark hover updates working on sites & apps - LGTM!

@gidjin gidjin merged commit 2dc25db into main Apr 21, 2023
@gidjin gidjin deleted the sc-1568/bookmark-hover-info branch April 21, 2023 16:45
This was referenced Apr 21, 2023
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.

5 participants