Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[MM-17406] Check if event target for setting item max is focused inside setting list before saving #3457

Merged
merged 4 commits into from
Aug 29, 2019

Conversation

devinbinnie
Copy link
Member

Summary

Existing behaviour was allowing any ENTER press on the DOM while a setting item was open to trigger the save on said setting list. This PR ensures that the focused element must be within the setting list on save.

Ticket Link

https://mattermost.atlassian.net/browse/MM-17406

@devinbinnie devinbinnie added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Aug 15, 2019
@devinbinnie devinbinnie added this to the v5.15.0 milestone Aug 15, 2019
@devinbinnie devinbinnie requested review from srkgupta, asaadmahmood and a team August 15, 2019 15:36
@ghost ghost requested review from stylianosrigas and removed request for a team August 15, 2019 15:36
@devinbinnie devinbinnie requested review from sudheerDev and a team and removed request for a team August 15, 2019 15:36
@srkgupta
Copy link
Contributor

Changes looks good. This will be tested as part of 5.15 release. Removing the QA Review label.

@srkgupta srkgupta removed the 3: QA Review Requires review by a QA tester label Aug 15, 2019
@srkgupta srkgupta removed their request for review August 15, 2019 15:46
@@ -134,7 +134,7 @@ export default class SettingItemMax extends React.PureComponent {
if (this.props.shiftEnter && e.keyCode === Constants.KeyCodes.ENTER && e.shiftKey) {
return;
}
if (isKeyPressed(e, Constants.KeyCodes.ENTER) && this.props.submit && e.target.tagName !== 'SELECT' && e.target.parentElement && e.target.parentElement.className !== 'react-select__input' && !e.target.classList.contains('btn-cancel')) {
if (isKeyPressed(e, Constants.KeyCodes.ENTER) && this.props.submit && e.target.tagName !== 'SELECT' && e.target.parentElement && e.target.parentElement.className !== 'react-select__input' && !e.target.classList.contains('btn-cancel') && this.settingList.current && this.settingList.current.contains(e.target)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we happen to add anymore to this condition consider splitting them into different consts by grouping these conditions.

@devinbinnie devinbinnie changed the title [MM-17406] Check if event target for setting item max is focused insde setting list before saving [MM-17406] Check if event target for setting item max is focused inside setting list before saving Aug 28, 2019
@amyblais
Copy link
Member

@stylianosrigas Please prioritize reviewing this.

Copy link

@stylianosrigas stylianosrigas left a comment

Choose a reason for hiding this comment

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

LGTM :)

@devinbinnie devinbinnie merged commit c187b42 into mattermost:master Aug 29, 2019
@devinbinnie devinbinnie deleted the MM-17406 branch August 29, 2019 13:13
@mattermod mattermod added AutomatedCherryPick and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Aug 29, 2019
devinbinnie pushed a commit that referenced this pull request Aug 29, 2019
* Check if event target for setting item max is focused inside setting list before saving

* Fixed a style issue
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation and removed 2: Dev Review Requires review by a core commiter labels Aug 30, 2019
skheria pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Oct 3, 2019
…de setting list before saving (mattermost#3457)

* [MM-17406] Check if event target for setting item max is focused inside setting list before saving

* Fixed a style issue
skheria pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Oct 3, 2019
…de setting list before saving (mattermost#3457)

* [MM-17406] Check if event target for setting item max is focused inside setting list before saving

* Fixed a style issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AutomatedCherryPick Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation
Projects
None yet
7 participants