Skip to content

Commit

Permalink
Refactor: ListView focus tracker check
Browse files Browse the repository at this point in the history
  • Loading branch information
gorzelinski committed Dec 4, 2023
1 parent b0e4bcb commit f40fa77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/ckeditor5-ui/src/list/listview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import View from '../view';
import FocusCycler from '../focuscycler';

import type ListItemView from './listitemview';
import ListItemView from './listitemview';
import ListItemGroupView from './listitemgroupview';
import ListSeparatorView from './listseparatorview';
import type ListSeparatorView from './listseparatorview';
import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable';
import ViewCollection from '../viewcollection';

Expand Down Expand Up @@ -142,7 +142,7 @@ export default class ListView extends View<HTMLUListElement> implements Dropdown
for ( const item of this.items ) {
if ( item instanceof ListItemGroupView ) {
this._registerFocusableItemsGroup( item );
} else if ( !( item instanceof ListSeparatorView ) ) {
} else if ( item instanceof ListItemView ) {
this._registerFocusableListItem( item );
}
}
Expand Down
5 changes: 2 additions & 3 deletions packages/ckeditor5-ui/tests/list/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
import FocusCycler from '../../src/focuscycler';
import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
import View from '../../src/view';
import { ListItemGroupView } from '../../src';
import { ListItemGroupView, ListItemView } from '../../src';

describe( 'ListView', () => {
let view;
Expand Down Expand Up @@ -499,10 +499,9 @@ describe( 'ListView', () => {
} );

function focusable( name ) {
const view = nonFocusable();
const view = new ListItemView();

view.name = name;
view.focus = () => {};

return view;
}
Expand Down

0 comments on commit f40fa77

Please sign in to comment.