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(Dropdown): handle on enter focusing when options are disabled #2025

Merged
merged 1 commit into from
May 17, 2019

Conversation

kmcfaul
Copy link
Contributor

@kmcfaul kmcfaul commented May 16, 2019

What: fix for handling when options are disabled. Focus should be on the first non-disabled item.

Refer to issue: Fixes #2017

@kmcfaul kmcfaul added the PF4 label May 16, 2019
@patternfly-build
Copy link
Contributor

PatternFly-React preview: https://2025-pr-patternfly-react-patternfly.surge.sh

@codecov-io
Copy link

codecov-io commented May 16, 2019

Codecov Report

Merging #2025 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2025      +/-   ##
==========================================
- Coverage   82.43%   82.41%   -0.03%     
==========================================
  Files         627      627              
  Lines        6951     6953       +2     
  Branches      119      119              
==========================================
  Hits         5730     5730              
- Misses       1162     1164       +2     
  Partials       59       59
Flag Coverage Δ
#patternfly3 84.88% <ø> (ø) ⬆️
#patternfly4 78.88% <0%> (-0.06%) ⬇️
#patternflymisc 95.68% <ø> (ø) ⬆️
Impacted Files Coverage Δ
...react-core/src/components/Dropdown/DropdownMenu.js 55.26% <0%> (-3.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b64bc3a...4066af2. Read the comment docs.

@@ -39,10 +39,14 @@ class DropdownMenu extends React.Component {

componentDidMount() {
if (this.props.openedOnEnter) {
if (this.props.component === 'ul') this.refsCollection[0].focus();
const focusTarget =
this.refsCollection.filter(
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, you can use .find() instead of .filter()[0]

@dlabaj dlabaj requested a review from tlabaj May 17, 2019 18:32
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

LGTM

@tlabaj tlabaj merged commit 8903702 into patternfly:master May 17, 2019
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.

PF4 Dropdown throws error if first DropdownItem is disabled with Tab key
5 participants