Skip to content

Commit

Permalink
Adds initialFocus prop typedefs (#1410)
Browse files Browse the repository at this point in the history
### Summary

Adds type definitions for the `initialFocus` prop available on `EuiModal` and `EuiPopover`

(discovered via elastic/kibana#28195)

### Checklist

- [ ] This was checked in mobile
- [ ] This was checked in IE11
- [ ] This was checked in dark mode
- [ ] Any props added have proper autodocs
- [ ] Documentation examples were added
- [ ] A [changelog](https://github.com/elastic/eui/blob/master/CHANGELOG.md) entry exists and is marked appropriately
- [ ] This was checked for breaking changes and labeled appropriately
- [ ] Jest tests were updated or added to match the most common scenarios
- [ ] This was checked against keyboard-only and screenreader scenarios
- [ ] This required updates to Framer X components
  • Loading branch information
legrego authored Jan 7, 2019
1 parent a28be25 commit 2fa8847
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `onBlur` prop to `EuiComboBox` ([#1400](https://github.com/elastic/eui/pull/1400))
- Added `initialFocus` prop typedefs to `EuiModal` and `EuiPopover` ([#1410](https://github.com/elastic/eui/pull/1410))

## [`6.2.0`](https://github.com/elastic/eui/tree/v6.2.0)

Expand Down
7 changes: 7 additions & 0 deletions src/components/modal/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonProps, Omit } from '../common';
/// <reference path="../button/index.d.ts" />

import { FocusTarget } from 'focus-trap';
import { ReactNode, SFC, HTMLAttributes } from 'react';

declare module '@elastic/eui' {
Expand All @@ -20,6 +21,12 @@ declare module '@elastic/eui' {
* set to a string for a custom width in custom measurement.
*/
maxWidth?: boolean | number | string;

/**
* Specifies what element should initially have focus;
* Can be a DOM node, or a selector string (which will be passed to document.querySelector() to find the DOM node), or a function that returns a DOM node.
*/
initialFocus?: FocusTarget;
}

export const EuiModal: SFC<
Expand Down
2 changes: 2 additions & 0 deletions src/components/popover/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonProps, NoArgCallback } from '../common';
/// <reference path="../panel/index.d.ts" />

import { FocusTarget } from 'focus-trap';
import { SFC, ReactNode, HTMLAttributes } from 'react';

declare module '@elastic/eui' {
Expand Down Expand Up @@ -31,6 +32,7 @@ declare module '@elastic/eui' {
withTitle?: boolean;
isOpen?: boolean;
ownFocus?: boolean;
initialFocus?: FocusTarget;
hasArrow?: boolean;
anchorClassName?: string;
anchorPosition?: PopoverAnchorPosition;
Expand Down

0 comments on commit 2fa8847

Please sign in to comment.