[8.8] [Lens] small drag and drop visual fixes (#159651) (#160172)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Lens] small drag and drop visual fixes
(#159651)](https://github.com/elastic/kibana/pull/159651)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-06-21T16:08:13Z","message":"[Lens]
small drag and drop visual fixes (#159651)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/159572\r\n\r\n1. The dimension
element should be invisible when being moved - fixed
by\r\n`.domDragDrop-isHidden` css below `.domDragDrop--isDragStarted`
that was\r\noverwriting opacity.\r\n\r\nbefore:\r\n<img width=\"508\"
alt=\"Screenshot 2023-06-14 at 09 45
23\"\r\nsrc=\"96dcd98e-3b71-4675-8e0f-1617cfacbd2d\">\r\nafter:\r\n<img
width=\"508\" alt=\"Screenshot 2023-06-14 at 10 01
08\"\r\nsrc=\"f3b9de10-a2e5-4936-9695-245a57a9a8d4\">\r\n\r\n\r\n\r\n2.
When navigating with keyboard, the margin of the element that
was\r\nmoving was slightly off - fixed by changing the
constant\r\n`REORDER_ITEM_MARGIN` value to 16. Not sure if we use this
package\r\nsomewhere else and I should also test
@jughosta?\r\n\r\nbefore:\r\n<img width=\"436\" alt=\"Screenshot
2023-06-14 at 09 45
38\"\r\nsrc=\"b6e3ad6e-fc6f-4c7f-850e-d3a4d8cf4775\">\r\nafter:
\r\n<img width=\"405\" alt=\"Screenshot 2023-06-14 at 10 01
16\"\r\nsrc=\"4b850ca2-64d2-4c2a-a313-a7c10434674a\">\r\n\r\n\r\n\r\n3.
When navigating with keyboard but not reordering, the ghost
element\r\nwas covering completely the element we would drop into. I
fixed it by\r\nchanging the translation values. I think that's not
expected? Or is this\r\nintentional?\r\nbefore:\r\n<img width=\"410\"
alt=\"Screenshot 2023-06-14 at 09 45
47\"\r\nsrc=\"60296878-ca52-4d0c-bb49-5a84503d48ac\">\r\nafter:\r\n<img
width=\"436\" alt=\"Screenshot 2023-06-14 at 10 01
24\"\r\nsrc=\"c050fea1-10b2-4a72-95d3-fbfe920b9c96\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"293a70b655f733f73c8b021e88f69bc666f66fc9","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:prev-minor","v8.9.0"],"number":159651,"url":"https://github.com/elastic/kibana/pull/159651","mergeCommit":{"message":"[Lens]
small drag and drop visual fixes (#159651)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/159572\r\n\r\n1. The dimension
element should be invisible when being moved - fixed
by\r\n`.domDragDrop-isHidden` css below `.domDragDrop--isDragStarted`
that was\r\noverwriting opacity.\r\n\r\nbefore:\r\n<img width=\"508\"
alt=\"Screenshot 2023-06-14 at 09 45
23\"\r\nsrc=\"96dcd98e-3b71-4675-8e0f-1617cfacbd2d\">\r\nafter:\r\n<img
width=\"508\" alt=\"Screenshot 2023-06-14 at 10 01
08\"\r\nsrc=\"f3b9de10-a2e5-4936-9695-245a57a9a8d4\">\r\n\r\n\r\n\r\n2.
When navigating with keyboard, the margin of the element that
was\r\nmoving was slightly off - fixed by changing the
constant\r\n`REORDER_ITEM_MARGIN` value to 16. Not sure if we use this
package\r\nsomewhere else and I should also test
@jughosta?\r\n\r\nbefore:\r\n<img width=\"436\" alt=\"Screenshot
2023-06-14 at 09 45
38\"\r\nsrc=\"b6e3ad6e-fc6f-4c7f-850e-d3a4d8cf4775\">\r\nafter:
\r\n<img width=\"405\" alt=\"Screenshot 2023-06-14 at 10 01
16\"\r\nsrc=\"4b850ca2-64d2-4c2a-a313-a7c10434674a\">\r\n\r\n\r\n\r\n3.
When navigating with keyboard but not reordering, the ghost
element\r\nwas covering completely the element we would drop into. I
fixed it by\r\nchanging the translation values. I think that's not
expected? Or is this\r\nintentional?\r\nbefore:\r\n<img width=\"410\"
alt=\"Screenshot 2023-06-14 at 09 45
47\"\r\nsrc=\"60296878-ca52-4d0c-bb49-5a84503d48ac\">\r\nafter:\r\n<img
width=\"436\" alt=\"Screenshot 2023-06-14 at 10 01
24\"\r\nsrc=\"c050fea1-10b2-4a72-95d3-fbfe920b9c96\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"293a70b655f733f73c8b021e88f69bc666f66fc9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/159651","number":159651,"mergeCommit":{"message":"[Lens]
small drag and drop visual fixes (#159651)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/159572\r\n\r\n1. The dimension
element should be invisible when being moved - fixed
by\r\n`.domDragDrop-isHidden` css below `.domDragDrop--isDragStarted`
that was\r\noverwriting opacity.\r\n\r\nbefore:\r\n<img width=\"508\"
alt=\"Screenshot 2023-06-14 at 09 45
23\"\r\nsrc=\"96dcd98e-3b71-4675-8e0f-1617cfacbd2d\">\r\nafter:\r\n<img
width=\"508\" alt=\"Screenshot 2023-06-14 at 10 01
08\"\r\nsrc=\"f3b9de10-a2e5-4936-9695-245a57a9a8d4\">\r\n\r\n\r\n\r\n2.
When navigating with keyboard, the margin of the element that
was\r\nmoving was slightly off - fixed by changing the
constant\r\n`REORDER_ITEM_MARGIN` value to 16. Not sure if we use this
package\r\nsomewhere else and I should also test
@jughosta?\r\n\r\nbefore:\r\n<img width=\"436\" alt=\"Screenshot
2023-06-14 at 09 45
38\"\r\nsrc=\"b6e3ad6e-fc6f-4c7f-850e-d3a4d8cf4775\">\r\nafter:
\r\n<img width=\"405\" alt=\"Screenshot 2023-06-14 at 10 01
16\"\r\nsrc=\"4b850ca2-64d2-4c2a-a313-a7c10434674a\">\r\n\r\n\r\n\r\n3.
When navigating with keyboard but not reordering, the ghost
element\r\nwas covering completely the element we would drop into. I
fixed it by\r\nchanging the translation values. I think that's not
expected? Or is this\r\nintentional?\r\nbefore:\r\n<img width=\"410\"
alt=\"Screenshot 2023-06-14 at 09 45
47\"\r\nsrc=\"60296878-ca52-4d0c-bb49-5a84503d48ac\">\r\nafter:\r\n<img
width=\"436\" alt=\"Screenshot 2023-06-14 at 10 01
24\"\r\nsrc=\"c050fea1-10b2-4a72-95d3-fbfe920b9c96\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
Risk Matrix\r\n\r\nDelete this section if it is not applicable to this
PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other
developers to\r\nidentify risks that should be tested prior to the
change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider
some of the following examples\r\nand how they may potentially impact
the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
Multiple Spaces&mdash;unexpected behavior in non-default Kibana
Space.\r\n| Low | High | Integration tests will verify that all features
are still\r\nsupported in non-default Kibana Space and when user
switches between\r\nspaces. |\r\n| Multiple nodes&mdash;Elasticsearch
polling might have race conditions\r\nwhen multiple Kibana nodes are
polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so
executing them multiple times will not result\r\nin logical error, but
will degrade performance. To test for this case we\r\nadd plenty of unit
tests around this logic and document manual testing\r\nprocedure. |\r\n|
Code should gracefully handle cases when feature X or plugin Y
are\r\ndisabled. | Medium | High | Unit tests will verify that any
feature flag\r\nor plugin combination still results in our service
operational. |\r\n| [See more potential
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
|\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for
breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"293a70b655f733f73c8b021e88f69bc666f66fc9"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-06-21 13:19:23 -04:00 committed by GitHub
parent f190fd1da9
commit 144056ef08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View file

@ -8,4 +8,4 @@
export const DEFAULT_DATA_TEST_SUBJ = 'domDragDrop';
export const REORDER_ITEM_HEIGHT = 32;
export const REORDER_ITEM_MARGIN = 8;
export const REORDER_ITEM_MARGIN = 16;

View file

@ -1100,12 +1100,12 @@ describe('DragDrop', () => {
expect(
component.find('[data-test-subj="testDragDrop-translatableDrop"]').at(0).prop('style')
).toEqual({
transform: 'translateY(-4px)',
transform: 'translateY(-8px)',
});
expect(
component.find('[data-test-subj="testDragDrop-translatableDrop"]').at(1).prop('style')
).toEqual({
transform: 'translateY(-4px)',
transform: 'translateY(-8px)',
});
component
@ -1258,7 +1258,7 @@ describe('DragDrop', () => {
expect(
component.find('[data-test-subj="testDragDrop-reorderableDrag"]').at(0).prop('style')
).toEqual({
transform: 'translateY(+4px)',
transform: 'translateY(+8px)',
});
expect(
component.find('[data-test-subj="testDragDrop-translatableDrop"]').at(0).prop('style')

View file

@ -15,7 +15,7 @@
width: 100%;
left: 0;
opacity: .9;
transform: translate($euiSizeXS, $euiSizeXS);
transform: translate($euiSizeS, $euiSizeL);
z-index: $domDragDropZLevel3;
pointer-events: none;
outline: $euiFocusRingSize solid currentColor; // Safari & Firefox
@ -138,6 +138,10 @@ $reorderItemMargin: $euiSizeS;
}
}
.domDragDrop--isDragStarted {
opacity: .5;
}
// Draggable item when it is moving
.domDragDrop-isHidden {
opacity: 0;
@ -149,10 +153,6 @@ $reorderItemMargin: $euiSizeS;
}
}
.domDragDrop--isDragStarted {
opacity: .5;
}
.domDragDrop__extraDrops {
opacity: 0;
visibility: hidden;