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

SLDS Menus -> PickList: keep focus after selecting an Item #89

Closed
cosminnicula opened this issue Nov 5, 2015 · 1 comment
Closed

SLDS Menus -> PickList: keep focus after selecting an Item #89

cosminnicula opened this issue Nov 5, 2015 · 1 comment
Assignees

Comments

@cosminnicula
Copy link

Related to #87

When the PickList is focused, I want to have a glowing border like below:

image

When the PickList is opened and I select an Item from the DropdownList, normally the DropdownList should collapse and the focus should be kept on the PickList. I can achieve this through the following code:

import React from 'react';
import ReactDOM from 'react-dom';
import PickList from 'ui/components/picklists/index.react';
const PT = React.PropTypes;

class MyPickList extends PickList {
  constructor(props) {
    super(props);
  }
  itemSelected (item) {
    super.toggleHidden();
    super.itemSelected(item);
    ReactDOM.findDOMNode(this).firstChild.focus();
  }
}

module.exports = MyPickList;

The only problem with this approach is that, when you select an Item the focus is lost from the PickList and then programmatically focused back, which causes a short flickering.

Same questions: is there a better way to achieve this? Would you consider a refactor to make this more flexible?

@rickschmoo
Copy link
Contributor

These components are not intended for consumption outside the SLDS website.

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

No branches or pull requests

4 participants