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

Enhance keyboard navigation's API #4054

Closed
zdrawku opened this issue Feb 26, 2019 · 9 comments
Closed

Enhance keyboard navigation's API #4054

zdrawku opened this issue Feb 26, 2019 · 9 comments
Assignees
Labels
grid: general keyboard-navigation 🧰 feature-request version: 7.2.x version: 7.3.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@zdrawku
Copy link
Contributor

zdrawku commented Feb 26, 2019

Description

We need to provide a way to overrite/change the current keyboard behavior in order to have more rich navigation capabilities. For example, to change the default navigation in the grid for tab key, to be column-based navigation, and not row-based or to navigate with keys different than the arrow keys.

Proposals

Provide callbacks for:

  • navigateTo(rowIndex: number, visibleColumnIndex: number, callback({targetType, target: Object }))
  • getNextCell(currentRowIndex, currentvisibleColumnIndex, callback(IgxColumnComponent)) - returns { rowIndex, visibleColumnIndex } which defines the next cell, that match specific criteria according to the current position
  • getPreviousCell(currentRowIndex, currentvisibleColumnIndex, callback(IgxColumnComponent)) - returns { rowIndex, visibleColumnIndex } which defines the previous cell, that match specific criteria according to the current position

Events

Currently we provide the following key interaction events

@ymita
Copy link
Contributor

ymita commented Mar 5, 2019

Hi @zdrawku
In addition to #4021, there is another use case. I would like to navigate cell to the next row by hitting Enter key. You can image cell navigation behavior on Excel. On Excel, when you have an active cell, hitting Enter key moves focus to the next row.

@ymita
Copy link
Contributor

ymita commented Apr 19, 2019

Hi @zdrawku , do you have a planned schedule for this feature?

@zdrawku
Copy link
Contributor Author

zdrawku commented Apr 19, 2019

Hey Yuki, we are currently working on the keyboard navigation api, we are finishing up the Specification, and next sprint we are going to start with the development.

@ymita
Copy link
Contributor

ymita commented Apr 19, 2019

Do you assume this feature will be available by the end of May?

@zdrawku
Copy link
Contributor Author

zdrawku commented Apr 19, 2019

Yes, I believe this feature will be availabe by the end of May. You can keep track of the progress here and whenever I have any updates, I will let you know.

@ymita
Copy link
Contributor

ymita commented Apr 19, 2019

That is great! Thank you! I will keep track of it here.

@zdrawku
Copy link
Contributor Author

zdrawku commented May 10, 2019

Hi @ymita, the feature is now available with version 7.2.8
StackBlitz live sample

@ddincheva did a great job with this feature and covered all scenarios mentioned in this issue and even more:

  • Double click on a cell from Orders column and after the cell is in edit mode, change the value to 7 and press tab key. Prompt message will be shown.
  • Select a cell and press Enter key a couple of times. Column based navigation will be applied.

@ymita
Copy link
Contributor

ymita commented May 13, 2019

Hi @zdrawku and @ddincheva,
Thank you very much for delivering this feature!! The StackBlitz sample helps a lot!

I see active cell moves both horizontally and vertically. I also confirm activation is skipped for non-editable cell. These are all great!

I notice one thing on the StackBlitz sample. After a cell is selected and hit Enter for the first time, the initially selected cell remains selected. For the second time and later, only one cell is selected. Is this going to be fixed later? Plese see this screenshot.
IgxGrid_cell_navigation

This can be prevented by deselecting the previously selected cell in the navigateTo method's callback.

    } else if (type === "dataCell" && args.event.key.toLowerCase() === "enter") {
      // Perform column based kb navigation with 'enter' key press
      args.cancel = true;

      this.grid1.navigateTo(target.rowIndex + 1, target.visibleColumnIndex,
        (obj) => {
          // Deselect the previously selected cell
          const cell = this.grid1.selectedCells[0] as IgxGridCellComponent;
          cell.selected = false;
          obj.target.nativeElement.focus();
        });
    }

@zdrawku
Copy link
Contributor Author

zdrawku commented May 21, 2019

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid: general keyboard-navigation 🧰 feature-request version: 7.2.x version: 7.3.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

No branches or pull requests

4 participants