adding an API function to focus on a document element

This commit is contained in:
Phoenixton 2019-03-11 22:54:11 +01:00
parent 26a822aeea
commit d7df1c18c1

View File

@ -4,6 +4,7 @@ import deprecate from 'util-deprecate';
import deepEqual from 'fast-deep-equal';
import { themes } from '@storybook/theming';
import { document } from 'global';
import merge from '../libs/merge';
const deprecatedThemeOptions = {
@ -149,6 +150,13 @@ export default function({ store }) {
});
},
focusOnUIElement(elementId) {
const element = document.getElementById(elementId);
if (element) {
element.focus();
}
},
setOptions: options => {
// The very first time the user sets their options, we don't consider what is in the store.
// At this point in time, what is in the store is what we *persisted*. We did that in order