Skip to content

Conversation

@jenny-s51
Copy link
Contributor

What: Closes #7570

@jenny-s51 jenny-s51 changed the title Menu ts chore(Menu): convert examples to TypeScript Jun 28, 2022
@patternfly-build
Copy link
Collaborator

patternfly-build commented Jun 28, 2022

@nicolethoen nicolethoen requested a review from kmcfaul July 5, 2022 15:49
Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Looking good so far! Had some comments for issues I noticed below, as well as the following:

  • For most of the examples, the onSelect method doesn't have any types on the parameters like the MenuWithCheckbox file does.

return validItem;
};

const loadMoreOptions = _stateCallback => {
Copy link
Contributor

Choose a reason for hiding this comment

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

When clicking the "view more" button, focus doesn't get set properl. Currently on the live site, clicking view more will place focus on the next active item that gets rendered in, whereas here that isn't the case.

It looks like it's because this stateCallback param is never actually being called anymore, so whatever callback is passed into loadMoreOptions isn't called.

Copy link
Contributor Author

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

Thank you for your review @thatblindgeye!

Addressed most of your comments. I'm investigating the focus issue you mentioned, which doesn't have a trivial solution.

The TSX/React Hooks version of the setState callback is useEffect, but combining useEffect with refs doesn't work the way we'd expect, so I will likely have to rewrite some logic in the ViewMore demo. Currently a WIP!

@thatblindgeye
Copy link
Contributor

Per discussion with @jenny-s51, I pushed a potential fix to the issue that arose with the View More example after converting to TS/functional components. One area of concern might be if the activeItem is set to a valid item when initialized (rather than 0/an invalid item in the example), but that could be resolved by passing a conditional into the useEffect hook to only set focus when the numOptions is greater than 3/the initial amount.

Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

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

Looks good!

There is a bit of a keyboard issue with drilldown + breadcrumbs I'm noticing where shift tabbing while within a drilled in menu won't immediately take focus to the breadcrumbs (requiring multiple shift tab keypresses). It looks like this was also present in our current docs so it wasn't the conversion, I believe it's probably to do with drilldown replacing the active menu in place so it must shift tab through previous menu containers before hitting the breadcrumbs. Since it's not a new bug I think it's probably outside this PR scope and should be a follow up/separate issue.

Copy link
Contributor Author

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

Thank you for adding back your updates @thatblindgeye !

@kmcfaul Ah nice catch - definitely a weird bug! I'm seeing that behavior persist in the existing docs as well. Since you're the one who caught this, would you like to open the related issue?

Copy link
Contributor Author

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

Conflicts should now be resolved - did a big rebase to pull in @nicolethoen 's updates from https://github.com/patternfly/patternfly-react/pull/7604/files

@nicolethoen nicolethoen self-requested a review July 27, 2022 14:17
@kmcfaul
Copy link
Contributor

kmcfaul commented Jul 27, 2022

@jenny-s51 Sure will do.

Edit - opened #7756

@nicolethoen nicolethoen merged commit 4652b4e into patternfly:main Jul 27, 2022
@patternfly-build
Copy link
Collaborator

Your changes have been released in:

  • eslint-plugin-patternfly-react@4.66.4
  • @patternfly/react-catalog-view-extension@4.78.4
  • @patternfly/react-charts@6.80.4
  • @patternfly/react-code-editor@4.68.4
  • @patternfly/react-console@4.78.4
  • @patternfly/react-core@4.227.4
  • @patternfly/react-docs@5.88.4
  • @patternfly/react-icons@4.78.4
  • @patternfly/react-inline-edit-extension@4.72.4
  • demo-app-ts@4.187.4
  • @patternfly/react-integration@4.189.4
  • @patternfly/react-log-viewer@4.72.4
  • @patternfly/react-styles@4.77.4
  • @patternfly/react-table@4.96.4
  • @patternfly/react-tokens@4.79.4
  • @patternfly/react-topology@4.74.4
  • @patternfly/react-virtualized-extension@4.74.4
  • transformer-cjs-imports@4.65.4

Thanks for your contribution! 🎉

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.

Menu: convert examples to TypeScript

5 participants