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
Conversation
src/AnnotationDialog.js
Outdated
* @protected | ||
* @return {void} | ||
*/ | ||
focusReplyEl() { |
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.
Could combine these two into a generic focus method that takes in a selector.
src/AnnotationDialog.js
Outdated
@@ -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); |
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.
Should we be listening to focus so that this also fires when you click in the input?
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 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
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.
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); |
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.
Does focus not fire on keydown in a mobile setting?
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.
Doesn't seem to
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 guess the focus event of clicking on the text area fires first usually
No description provided.