-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Editor: Fix tags bug by using correct container for blur event #2054
Conversation
@@ -81,7 +91,8 @@ var TokenField = React.createClass( { | |||
scrollIntoView={ this.state.selectedSuggestionScroll } | |||
isExpanded={ this.state.isActive } | |||
onHover={ this._onSuggestionHovered } | |||
onSelect={ this._onSuggestionSelected } /> | |||
onSelect={ this._onSuggestionSelected } | |||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had the linter warn me on a branch that the closing tag should be on the same line as the last prop. This was "new" to me, but figured I'd mention it here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had the linter warn me on a branch that the closing tag should be on the same line as the last prop.
I believe this only applies to self-closing tags, and was added in #1807.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm strongly in favor of putting the />
(and even the >
for tags with children) on the following line, de-indented 1 level:
- Like
</div>
);
}
etc. that often appear immediately below, it denotes the end of a block - Easier to rearrange props, like trailing
,
in arrays
We have lots of code in both styles in Calypso. If we want to do something about this, let's do it in a separate PR and either remove that linter rule or update our code to this style.
Also for Firefox and IE11 there need using in _onBlur handler instead var relatedTarget = event.relatedTarget ||
event.explicitOriginalTarget || // FF
document.activeElement; // IE11 details about it facebook/react#2011 |
I can confirm that Marking as needs changes per linting error and response to above comment. |
Fixed the failing tests - looks like it's due to a React TestUtils thing-I-thought-was-a-bug-but-isnt (facebook/react#5778). |
Looks good to me 👍 Two things to follow-up on:
|
|
Editor: Fix tags bug by using correct container for blur event
Fixes #1884, and other strange behavior, which I suspect is also related to the following forum threads:
The reason this code change fixes these issues is that the
blur
event target is usually the text input, but we need to check the entire TokenField container for therelatedTarget
instead. Looks like this was changed here - cc @aduth.To test