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

[EuiDataGrid] Fix multiple grid focus restoration issues #5530

Merged
merged 11 commits into from
Jan 12, 2022

Commits on Jan 11, 2022

  1. [elastic#5517] Add isFocusedCellInView state to track visibility

    - and use this to determine whether or not the entire grid should have a tabindex/be focusable, rather than a simple 'hasFocus' check which doesn't account for virtualization
    
    - Add new mockFocusContext for easier testing for various tests that need to set a focus context
    
    - EuiDataGridCell
      - DRY out an `this.isFocusedCell` method
      - Call `setIsFocusedCellInView` on mount and on unmount (`setFocusedCell` handles setting true/false on new cell focus)
      - Write new unit tests for componentWillUnmount
      - Clean up unnecessary uncovered function fallback for this.unsubscribeCell - we're already checking for a falsy value before calling it
    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    c06db86 View commit details
    Browse the repository at this point in the history
  2. [REVERT] Update demo to test noninteractive headers with scrolling co…

    …ntent
    
    - see http://localhost:8030/#/tabular-content/data-grid-focus
    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    7f031ac View commit details
    Browse the repository at this point in the history
  3. [elastic#5517] Add onItemsRendered ref to store currently visible/v…

    …irtualized refs
    
    - see https://react-window.vercel.app/#/api/FixedSizeGrid for `onItemsRendered` API
    - this struck me as the quickest/easiest way to determine which virtualized cells are in view
    - I opted to save this as a ref instead of as state as I didn't see the need to cause a rerender
    
    - `focusFirstVisibleInteractiveCell` was split out to its own fn as it will shortly be used elsewhere to fix another focus bug in the grid
    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    2f44ab9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d29d938 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8a035de View commit details
    Browse the repository at this point in the history
  6. Add changelog entry

    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    129febd View commit details
    Browse the repository at this point in the history
  7. Revert "[REVERT] Update demo to test noninteractive headers with scro…

    …lling content"
    
    This reverts commit 7f031ac.
    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    0fce549 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4fad086 View commit details
    Browse the repository at this point in the history
  9. Merge branch 'main' into datagrid/5517/4923/5476

    Constance authored Jan 11, 2022
    Configuration menu
    Copy the full SHA
    bd7f192 View commit details
    Browse the repository at this point in the history
  10. [PR feedback] Account for empty grids

    - gridItemsRendered will be falsey if rowCount is 0 and will cause an error on tab, so we should opt to simply leave focus on the grid body wrapper
    cee-chen committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    9a69534 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2022

  1. Configuration menu
    Copy the full SHA
    694621b View commit details
    Browse the repository at this point in the history