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

fix: Create reflowable card footer buttons #5852

Merged
merged 4 commits into from
Aug 16, 2022

Conversation

pownkel
Copy link
Contributor

@pownkel pownkel commented Jul 30, 2022

Details

Extracts out some of the work in #5745, plus additional refactors:

  • Add a new narrowModeThreshold for reflowing card footers
  • Create a new component, CardFooterFarButtons, a reflowable and refactored version of CardKebabMenuButton

The gifs below show the behavior or CardFooterFarButtons when it is resized, but this PR does not use CardFooterFarButtons anywhere in the UI. Replacing CardKebabMenuButton and passing NarrowModeStatus through to the cards will be done in a separate PR.

card footer buttons reflowing as window is resized

CardFooterFarButtons also makes sure that focus correctly returns to the "..." button or the "file issue" button when the issue filing settings dialog is closed:
demo of focus handling when issue filing settings is opened and closed

Motivation

Partially addresses #5609

Context

Deferred to future PRs:

  • Further refactor CardFooterFarButtons to use store state instead of UI state to determine whether the issue filing dialog is open (this will allow renderIssueFilingSettingContent() to be extracted to a different file)
  • Replace CardKebabMenuButton with CardFooterFarButtons in the cards UI
  • Pass NarrowModeStatus through to the cards components

(copied from #5745) Also worth mentioning is that this PR uses the width of the entire screen to determine if cards should reflow, rather than the width of the cards themselves. This is not ideal, especially in electron where both the left nav and the right-hand screenshot also resize as the screen resizes, and the card width is affected by more than just screen width. It doesn't make a huge difference from a user perspective, but in the future, we may want to consider refactoring NarrowModeDetector to be more generic (it currently assumes that it's measuring the width of the whole screen and sets its thresholds accordingly) and adding another NarrowModeDetector to the element containing the cards.

Pull request checklist

  • [n/a] Addresses an existing issue: #0000
  • Ran yarn fastpass
  • Added/updated relevant unit test(s) (and ran yarn test)
  • Verified code coverage for the changes made. Check coverage report at: <rootDir>/test-results/unit/coverage
  • PR title AND final merge commit title both start with a semantic tag (fix:, chore:, feat(feature-name):, refactor:). See CONTRIBUTING.md.
  • [n/a] (UI changes only) Added screenshots/GIFs to description above
  • [n/a] (UI changes only) Verified usability with NVDA/JAWS

@pownkel pownkel changed the title Fix: Create reflowable card footer buttons fix: Create reflowable card footer buttons Jul 30, 2022
@pownkel pownkel marked this pull request as ready for review July 30, 2022 00:10
@pownkel pownkel requested a review from a team as a code owner July 30, 2022 00:10
Copy link
Contributor

@madalynrose madalynrose left a comment

Choose a reason for hiding this comment

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

This looks awesome! What a great improvement!

The only thing I'm hesitant about is the name CardFooterFarButtons. What is the intent of the word Far here? I think we can come up with a more illustrative name.

Ideas:

  • CardFooterMenuItems keeps naming aligned with CardFooterMenuItemsBuilder and brings to mind that this contains items that might be presented as a menu.
  • CardFooterInstanceActionButtons captures that these are the actions a user can take on the failure instance (and also these are ActionButtons)

@pownkel
Copy link
Contributor Author

pownkel commented Aug 10, 2022

Thanks for the suggestion, @madalynrose! I changed the class name to CardFooterInstanceActionButtons to avoid confusion with the CardFooterMenuItem type.

Copy link
Contributor

@madalynrose madalynrose left a comment

Choose a reason for hiding this comment

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

Awesome! 🚀

@pownkel pownkel merged commit 7c7f09c into microsoft:main Aug 16, 2022
@pownkel pownkel deleted the card-footer-far-buttons branch August 16, 2022 20:23
pownkel added a commit that referenced this pull request Aug 25, 2022
…ns (#5935)

#### Details
Use store state instead of component state to determine when the issue filing settings dialog is open

##### Motivation
We should avoid using component state where possible, because it can lead to tightly coupled components if we decide to split up a file. In this case, we currently need to pass callbacks to CardFooterMenuItemsBuilder to set the state of CardFooterInstanceActionButtons, which is a confusing flow of data and doesn't fit the flux paradigm.

Instead of a background store, this PR creates a view-side CardsViewStore with the same pattern as TabStopsViewStore, which will reset its state when the page is refreshed so the dialog doesn't stay open between refreshes.

##### Context
Continues a change from #5852. CardFooterInstanceActionButtons is not currently used anywhere in the UI, but will be wired up in a future PR.

We currently have another dialog, the Export Report dialog, which is controlled by component state instead of store state. We may want to refactor that in a future PR for consistency.
pownkel added a commit that referenced this pull request Sep 16, 2022
#### Details

Replaces `CardKebabMenuButton` with CardFooterInstanceActionButtons`,
which will reflow the buttons currently in the kebab menu in the card
footer in both web and electron. GIFs below showing the card footer
reflow in action (copied from #5852)
![card footer buttons reflowing as window is
resized](https://user-images.githubusercontent.com/55459788/178857149-63590123-322d-4243-a4c1-cbcbe876ab9d.gif)
![demo of focus handling when issue filing settings is opened and
closed](https://user-images.githubusercontent.com/55459788/178857155-8de62725-cef2-4937-a9e1-b54e17747c79.gif)

Other changes in this PR:
- Initialize a CardsViewStore and relevant objects in DetailsView and
render-initializer
- Move rendering for the issue filing settings dialogue into a
higher-level component (`IssuesTable` in web and `TestView` in Electron)
to fix a bug where every card was rendering its own separate dialogue,
each with callbacks to focus a different button
- Add state relevant to the issue filing settings dialogue to
`CardsViewStoreData`

##### Motivation

Finishes addressing #5609 to add reflow behavior to the cards UI

##### Context

Continues work from #5852 and #5935

#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a"
in the checkbox -->
- [x] Addresses an existing issue: #5609
- [x] Ran `yarn null:autoadd`
- [x] Ran `yarn fastpass`
- [x] Added/updated relevant unit test(s) (and ran `yarn test`)
- [x] Verified code coverage for the changes made. Check coverage report
at: `<rootDir>/test-results/unit/coverage`
- [x] PR title *AND* final merge commit title both start with a semantic
tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See
`CONTRIBUTING.md`.
- [x] (UI changes only) Added screenshots/GIFs to description above
- [x] (UI changes only) Verified usability with NVDA/JAWS
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.

2 participants