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

Fixed issue when the preview images navigation is triggered by moving the input filed cursor using arrow keys #25991

Merged

Conversation

drpayyne
Copy link
Contributor

@drpayyne drpayyne commented Dec 11, 2019

Description

  • Added a more specific selector for keyboard navigation listener

Fixed Issues

  1. The Preview images are changed if move the cursor with arrow keys in File Name field adobe-stock-integration#847: The Preview images are changed if move the cursor with arrow keys in File Name field

Manual testing scenarios

  1. Open Adobe Stock Panel
  2. Verify ability to navigate opened preview images using keyboard
  3. Click Save Preview for an image for filename prompt to open
  4. Verify ability to navigate between characters inside input field when prompt is open

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Dec 11, 2019

Hi @drpayyne. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @drpayyne , please take a look at the comment below.

It will be great if you could also add a test coverage for this case as part of the PR: either MFTF or js

@@ -46,7 +46,7 @@ define([
*/
initialize: function () {
this._super();
$(document).on('keydown', this.handleKeyDown.bind(this));
$('.modal-slide.adobe-stock-modal').on('keydown', this.handleKeyDown.bind(this));
Copy link
Member

Choose a reason for hiding this comment

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

Can you please move this selector to defaults

Copy link
Contributor Author

@drpayyne drpayyne Dec 11, 2019

Choose a reason for hiding this comment

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

Done, thanks! I also added a check to see if an input element is active to prevent image navigation when the search textbox is active. This also works for the image quantity for the page, but for some reason, not for the page number counter itself... Any thoughts?

Related: magento/adobe-stock-integration#846

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Thanks for update @drpayyne ! Please see my comment

@@ -13,6 +13,7 @@ define([
defaults: {
bodyTmpl: 'ui/grid/columns/image-preview',
previewImageSelector: '[data-image-preview]',
adobeStockModalSelector: '.modal-slide.adobe-stock-modal',
Copy link
Member

Choose a reason for hiding this comment

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

can the selector (and property) be modified not to mention adobe stock (as that is not currently adobe stock scope)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this too, thanks!

@sivaschenko sivaschenko changed the title Fixed Adobe Stock Integration #847 Fixed issue when the preview images navigation is triggered by moving the input filed cursor using arrow keys Dec 12, 2019
@drpayyne
Copy link
Contributor Author

@sivaschenko, ICYMI.

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request @drpayyne ! Please see my comment

@@ -130,6 +131,11 @@ define([
show: function (record) {
var img;

if (!this.isListenerActive) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe we can check for visibleRecord in handleKeyDown without introducing the new field and show method logic complication

@m2-assistant
Copy link

m2-assistant bot commented Jan 17, 2020

Hi @drpayyne, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@sivaschenko
Copy link
Member

Sorry, closed the wrong pull request by mistake

@sivaschenko sivaschenko reopened this Jan 17, 2020
@ghost ghost unassigned sivaschenko Jan 17, 2020
@sivaschenko sivaschenko added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Jan 27, 2020
@ghost ghost assigned sivaschenko Jan 27, 2020
@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Rechecked on Save Preview window
save

and on License Images... window
license

The cursor is moved but the Preview images - not
The arrow keys switch the preview images properly when no Confirm window is opened

@engcom-Golf
Copy link
Contributor

I will take care of test coverage.

@engcom-Golf engcom-Golf added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Jan 30, 2020
@engcom-Golf
Copy link
Contributor

Hi @sivaschenko could you please review test coverage ?

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Thanks for test coverage @Nazar65 ! Please see my review comments

it('veify record changed on key down', function () {
var recordMock = {
_rowIndex: 2
},
Copy link
Member

Choose a reason for hiding this comment

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

@Nazar65 @engcom-Golf the formatting is not consistent, lines 53-54 require additional indentation

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@@ -46,5 +46,39 @@ define([
});

});

describe('handleKeyDown method', function () {
Copy link
Member

Choose a reason for hiding this comment

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

It would be good also to test the case when the active element is input

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@magento-engcom-team
Copy link
Contributor

Hi @sivaschenko, thank you for the review.
ENGCOM-6692 has been created to process this Pull Request

magento-engcom-team pushed a commit that referenced this pull request Feb 13, 2020
…red by moving the input filed cursor using arrow keys #25991
@magento-engcom-team magento-engcom-team merged commit 7a88ffc into magento:2.4-develop Feb 13, 2020
@m2-assistant
Copy link

m2-assistant bot commented Feb 13, 2020

Hi @drpayyne, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants