Skip to content

Commit

Permalink
Merge pull request #12 from xenobytezero/gutenberg_5.4_fixes
Browse files Browse the repository at this point in the history
Fixes for latest Gutenberg 5.4 version
  • Loading branch information
Matt Dickey authored Apr 26, 2019
2 parents 3c7a2c7 + ed36561 commit e6acf66
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/PostSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class PostSelector extends Component {
}

// check if we have the source post types from the API
if (!sourcePostTypes) {
if (sourcePostTypes == null) {
return;
}

Expand Down Expand Up @@ -312,15 +312,15 @@ class PostSelector extends Component {
}

render() {
this.resolvePostTypes(sourcePostTypes);
this.resolvePostTypes(this.props.sourcePostTypes);
const { autoFocus = true, instanceId, limit } = this.props;
const { showSuggestions, posts, selectedSuggestion, loading, input } = this.state;
const inputDisabled = !!limit && this.props.posts.length >= limit;
/* eslint-disable jsx-a11y/no-autofocus */
return (
<Fragment>
{this.renderSelectedPosts()}
<div className="editor-url-input">
<div className="block-editor-url-input">
<input
autoFocus={autoFocus}
type="text"
Expand All @@ -334,8 +334,8 @@ class PostSelector extends Component {
role="combobox"
aria-expanded={showSuggestions}
aria-autocomplete="list"
aria-owns={`editor-url-input-suggestions-${instanceId}`}
aria-activedescendant={selectedSuggestion !== null ? `editor-url-input-suggestion-${instanceId}-${selectedSuggestion}` : undefined}
aria-owns={`block-editor-url-input-suggestions-${instanceId}`}
aria-activedescendant={selectedSuggestion !== null ? `block-editor-url-input-suggestion-${instanceId}-${selectedSuggestion}` : undefined}
style={{ width: '100%' }}
disabled={inputDisabled}
/>
Expand All @@ -344,15 +344,15 @@ class PostSelector extends Component {
{showSuggestions &&
!!posts.length && (
<Popover position="bottom" noArrow focusOnMount={false}>
<div className="editor-url-input__suggestions" id={`editor-url-input-suggestions-${instanceId}`} ref={this.bindListNode} role="listbox">
<div className="block-editor-url-input__suggestions" id={`block-editor-url-input-suggestions-${instanceId}`} ref={this.bindListNode} role="listbox">
{posts.map((post, index) => (
<button
key={post.id}
role="option"
tabIndex="-1"
id={`editor-url-input-suggestion-${instanceId}-${index}`}
id={`block-editor-url-input-suggestion-${instanceId}-${index}`}
ref={this.bindSuggestionNode(index)}
className={`editor-url-input__suggestion ${index === selectedSuggestion ? 'is-selected' : ''}`}
className={`block-editor-url-input__suggestion ${index === selectedSuggestion ? 'is-selected' : ''}`}
onClick={() => this.selectLink(post)}
aria-selected={index === selectedSuggestion}
>
Expand Down

0 comments on commit e6acf66

Please sign in to comment.