feat(framework): ItemNavigation cyclic behavior implemented for multiple rows #2780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
ItemNavigation
is now fully synchronous, it no longer awaits for rendering to have finished as it no longer needs to (this was necessary in the past when there were item navigation events such as "borderReached" that could trigger invalidation).behavior
is set toCyclic
androwSize
is set to a number greater than1
(the items are represented as a matrix rather than a vector), reaching the end of a row moves the focus to the next row and reaching the end of a column moves the focus to the next column and vice versa. Reaching the last item in the matrix moves the focus to the first and vice versa, creating a loop.ItemNavigation
was refactored: some functions unified (onkeydown
+_onKeyPress
since they are part of the same logic), others deleted (because they were just returning private members), theevent
object is no longer passed several times only to be prevented, but is prevented directly inside the event handler, as is the best practice.The
Cyclic
item navigation behavior was applied toProductSwitch.js
, because it works well even when the matrix is not complete (the last row has fewer items). In contrast, the currentStatic
ProductSwitch.js
item navigation behavior could be considered strange when operating on incomplete rows, because the focus "jumps" to the last item skipping several items.In addition, removed the
console.log
from thebundle.esm.js
file as it is too spammy during tests execution.Related to: #2731