Skip to content
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

Fix: Validation message fails to get displayed when user clicks on 'Post' without entering any comment while adding a Point Annotation. #27

Merged
merged 4 commits into from Nov 14, 2017

Conversation

pramodsum
Copy link
Contributor

No description provided.

* @protected
* @return {void}
*/
focusReplyEl() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could combine these two into a generic focus method that takes in a selector.

@@ -330,13 +331,45 @@ class AnnotationDialog extends EventEmitter {
this.element.addEventListener('mouseup', this.stopPropagation);
this.element.addEventListener('wheel', this.stopPropagation);

const replyTextEl = this.element.querySelector(`.${CLASS_REPLY_TEXTAREA}`);
if (replyTextEl) {
replyTextEl.addEventListener('keydown', this.focusReplyEl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be listening to focus so that this also fires when you click in the input?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to remove the red border once you type something into the text area rather than when you click into it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Played around w/ it a little more. Changing it back to fire on 'focus' rather than 'keydown'

this.cancelEl.addEventListener('click', this.onCancel);
this.postEl.addEventListener('click', this.onPost);
if (this.hasTouch) {
this.textAreaEl.addEventListener('keydown', this.focus);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does focus not fire on keydown in a mobile setting?

Copy link
Contributor Author

@pramodsum pramodsum Nov 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the focus event of clicking on the text area fires first usually

@pramodsum pramodsum merged commit d90e72c into box:master Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants