fix dropdown bug on safari

This commit is contained in:
Cassie Tarakajian 2016-10-19 13:03:19 -04:00
parent 5e36617de4
commit a4b6dd194e
4 changed files with 15 additions and 10 deletions

View File

@ -103,11 +103,11 @@ class Editor extends React.Component {
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
}
if (this.props.file.name !== prevProps.name) {
if (this.props.file.name.match(/.+\.js$/)) {
if (this.props.file.name.match(/.+\.js$/i)) {
this._cm.setOption('mode', 'javascript');
} else if (this.props.file.name.match(/.+\.css$/)) {
} else if (this.props.file.name.match(/.+\.css$/i)) {
this._cm.setOption('mode', 'css');
} else if (this.props.file.name.match(/.+\.html$/)) {
} else if (this.props.file.name.match(/.+\.html$/i)) {
this._cm.setOption('mode', 'htmlmixed');
}
}
@ -155,8 +155,9 @@ class Editor extends React.Component {
className="editor__options-button"
aria-label="editor options"
tabIndex="0"
onClick={(e) => {
e.target.focus();
ref="optionsButton"
onClick={() => {
this.refs.optionsButton.focus();
this.props.showEditorOptions();
}}
onBlur={() => setTimeout(this.props.closeEditorOptions, 200)}

View File

@ -117,8 +117,10 @@ export class FileNode extends React.Component {
<button
className="sidebar__file-item-show-options"
aria-label="view file options"
onClick={(e) => {
e.target.focus();
ref={`fileOptions-${this.props.id}`}
tabIndex="0"
onClick={() => {
this.refs[`fileOptions-${this.props.id}`].focus();
this.props.showFileOptions(this.props.id);
}}
>

View File

@ -256,7 +256,7 @@ class PreviewFrame extends React.Component {
frameBorder="0"
ref="iframe"
title="sketch output"
sandbox="allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms"
sandbox="allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-forms"
/>
);
}

View File

@ -38,8 +38,10 @@ class Sidebar extends React.Component {
<button
aria-label="add file or folder"
className="sidebar__add"
onClick={(e) => {
e.target.focus();
tabIndex="0"
ref="sidebarOptions"
onClick={() => {
this.refs.sidebarOptions.focus();
this.props.openProjectOptions();
}}
onBlur={() => setTimeout(this.props.closeProjectOptions, 200)}