# 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—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—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—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—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—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—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 folder contains packages that are intended for use in Kibana and Kibana
plugins.
tl;dr:
Don't publish to npm registry
Always use the @kbn namespace
Always set "private": true in package.json
Using these packages
We no longer publish these packages to the npm registry. Now, instead of
specifying a version when including these packages, we rely on yarn workspaces,
which sets up a symlink to the package.
For example if you want to use the @kbn/i18n package in Kibana itself, you
can specify the dependency like this:
"@kbn/i18n": "1.0.0"
However, if you want to use this from a Kibana plugin, you need to use a link:
dependency and account for the relative location of the Kibana repo, so it would
instead be:
Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.
Jest
A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.
A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.
yarn test runs all unit tests.
yarn jest runs all Jest tests in Kibana.
In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.
Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.