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(Portal): do not take focus after first render #1215

Merged
merged 2 commits into from
Jan 24, 2017

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Jan 24, 2017

Fixes #1199

This PR addresses a bug introduced in #1154. The portal takes focus on render for keyboard access, however, it takes focus on every render. This means if you have a stateful Portal (Modal, Popup, etc) then it will take focus away from form controls on every render.

This PR simply adds a check/test for the initial render and only takes focus on the initial render. This way, Portal components are still keyboard accessible but also do not take focus from other controls after the initial render.

@codecov-io
Copy link

Current coverage is 95.89% (diff: 100%)

Merging #1215 into master will increase coverage by <.01%

@@             master      #1215   diff @@
==========================================
  Files           879        879          
  Lines          4890       4895     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           4689       4694     +5   
  Misses          201        201          
  Partials          0          0          

Powered by Codecov. Last update efd079b...fcde084

@levithomason levithomason merged commit dc5ed31 into master Jan 24, 2017
@levithomason levithomason deleted the fix/portal-focus branch January 24, 2017 18:33
@levithomason
Copy link
Member Author

Released in semantic-ui-react@0.64.4.

DomiR added a commit to DomiR/Semantic-UI-React that referenced this pull request Jan 26, 2017
* Semantic-Org/master: (111 commits)
  fix(docs): fix usage of arrow function (Semantic-Org#1228)
  fix(Icon): Incorrect definition in typings (Semantic-Org#1225)
  fix(Button): fix `tabIndex` in typings (Semantic-Org#1224)
  fix(typings): add item prop to the DropdownProps (Semantic-Org#1223)
  docs(examples): add missing `key` props (Semantic-Org#1220)
  docs(changelog): update changelog [ci skip]
  0.64.4
  feat(Form): add `inverted` prop (Semantic-Org#1218)
  fix(ComponentExample): use explicit babel presets (Semantic-Org#1219)
  style(Button): update typings and propTypes usage (Semantic-Org#1216)
  style(Embed): update typings and propTypes usage (Semantic-Org#1217)
  chore(package): support for jsnext:main (Semantic-Org#1210)
  style(Step): update typings, tests and propTypes usage (Semantic-Org#1203)
  fix(Portal): do not take focus after first render (Semantic-Org#1215)
  style(Table|mixed): update typings, tests and propTypes usage (Semantic-Org#1200)
  fix(Dropdown): use `item` instead of `as={Menu.Item}` (Semantic-Org#659)
  fix(Dropdown): respect `closeOnBlur={false}` (Semantic-Org#1148)
  style(Breadcrumb): update typings and propTypes usage (Semantic-Org#1209)
  style(Dimmer): update typings (Semantic-Org#1208)
  fix(Divider|FormInput): fix the broken typings (Semantic-Org#1179)
  ...
harel pushed a commit to harel/Semantic-UI-React that referenced this pull request Feb 18, 2017
* fix(ComponentProps): add child key

* fix(Portal): do not take focus after first render
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.

None yet

2 participants