@ckeditor/ckeditor5-ui 35.2.1 → 35.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/package.json +31 -23
  2. package/src/bindings/addkeyboardhandlingforgrid.js +45 -57
  3. package/src/bindings/clickoutsidehandler.js +15 -21
  4. package/src/bindings/injectcsstransitiondisabler.js +16 -20
  5. package/src/bindings/preventdefault.js +6 -8
  6. package/src/bindings/submithandler.js +5 -7
  7. package/src/button/button.js +5 -0
  8. package/src/button/buttonview.js +220 -259
  9. package/src/button/switchbuttonview.js +56 -71
  10. package/src/colorgrid/colorgridview.js +135 -197
  11. package/src/colorgrid/colortileview.js +37 -47
  12. package/src/colorgrid/utils.js +57 -66
  13. package/src/componentfactory.js +79 -93
  14. package/src/dropdown/button/dropdownbutton.js +5 -0
  15. package/src/dropdown/button/dropdownbuttonview.js +44 -57
  16. package/src/dropdown/button/splitbuttonview.js +159 -207
  17. package/src/dropdown/dropdownpanelfocusable.js +5 -0
  18. package/src/dropdown/dropdownpanelview.js +101 -112
  19. package/src/dropdown/dropdownview.js +396 -438
  20. package/src/dropdown/utils.js +164 -213
  21. package/src/editableui/editableuiview.js +125 -141
  22. package/src/editableui/inline/inlineeditableuiview.js +44 -54
  23. package/src/editorui/bodycollection.js +61 -75
  24. package/src/editorui/boxed/boxededitoruiview.js +91 -104
  25. package/src/editorui/editoruiview.js +30 -39
  26. package/src/focuscycler.js +214 -245
  27. package/src/formheader/formheaderview.js +58 -70
  28. package/src/icon/iconview.js +145 -111
  29. package/src/iframe/iframeview.js +37 -49
  30. package/src/index.js +0 -17
  31. package/src/input/inputview.js +170 -198
  32. package/src/inputnumber/inputnumberview.js +48 -56
  33. package/src/inputtext/inputtextview.js +14 -18
  34. package/src/label/labelview.js +44 -53
  35. package/src/labeledfield/labeledfieldview.js +212 -235
  36. package/src/labeledfield/utils.js +39 -57
  37. package/src/labeledinput/labeledinputview.js +190 -221
  38. package/src/list/listitemview.js +40 -50
  39. package/src/list/listseparatorview.js +15 -19
  40. package/src/list/listview.js +94 -115
  41. package/src/model.js +19 -25
  42. package/src/notification/notification.js +151 -202
  43. package/src/panel/balloon/balloonpanelview.js +535 -628
  44. package/src/panel/balloon/contextualballoon.js +611 -732
  45. package/src/panel/sticky/stickypanelview.js +238 -270
  46. package/src/template.js +1049 -1479
  47. package/src/toolbar/balloon/balloontoolbar.js +337 -424
  48. package/src/toolbar/block/blockbuttonview.js +32 -42
  49. package/src/toolbar/block/blocktoolbar.js +375 -477
  50. package/src/toolbar/normalizetoolbarconfig.js +17 -21
  51. package/src/toolbar/toolbarlinebreakview.js +15 -19
  52. package/src/toolbar/toolbarseparatorview.js +15 -19
  53. package/src/toolbar/toolbarview.js +866 -1053
  54. package/src/tooltipmanager.js +324 -353
  55. package/src/view.js +389 -430
  56. package/src/viewcollection.js +147 -178
  57. package/src/button/button.jsdoc +0 -165
  58. package/src/dropdown/button/dropdownbutton.jsdoc +0 -22
  59. package/src/dropdown/dropdownpanelfocusable.jsdoc +0 -27
@@ -2,21 +2,15 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/dropdown/button/splitbuttonview
8
7
  */
9
-
10
8
  import View from '../../view';
11
9
  import ButtonView from '../../button/buttonview';
12
-
13
10
  import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
14
11
  import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
15
-
16
12
  import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
17
-
18
13
  import '../../../theme/components/dropdown/splitbutton.css';
19
-
20
14
  /**
21
15
  * The split button view class.
22
16
  *
@@ -38,205 +32,163 @@ import '../../../theme/components/dropdown/splitbutton.css';
38
32
  * @extends module:ui/view~View
39
33
  */
40
34
  export default class SplitButtonView extends View {
41
- /**
42
- * @inheritDoc
43
- */
44
- constructor( locale ) {
45
- super( locale );
46
-
47
- const bind = this.bindTemplate;
48
-
49
- // Implement the Button interface.
50
- this.set( 'class' );
51
- this.set( 'icon' );
52
- this.set( 'isEnabled', true );
53
- this.set( 'isOn', false );
54
- this.set( 'isToggleable', false );
55
- this.set( 'isVisible', true );
56
- this.set( 'keystroke' );
57
- this.set( 'label' );
58
- this.set( 'tabindex', -1 );
59
- this.set( 'tooltip' );
60
- this.set( 'tooltipPosition', 's' );
61
- this.set( 'type', 'button' );
62
- this.set( 'withText', false );
63
-
64
- /**
65
- * Collection of the child views inside of the split button {@link #element}.
66
- *
67
- * @readonly
68
- * @member {module:ui/viewcollection~ViewCollection}
69
- */
70
- this.children = this.createCollection();
71
-
72
- /**
73
- * A main button of split button.
74
- *
75
- * @readonly
76
- * @member {module:ui/button/buttonview~ButtonView}
77
- */
78
- this.actionView = this._createActionView();
79
-
80
- /**
81
- * A secondary button of split button that opens dropdown.
82
- *
83
- * @readonly
84
- * @member {module:ui/button/buttonview~ButtonView}
85
- */
86
- this.arrowView = this._createArrowView();
87
-
88
- /**
89
- * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
90
- * keystrokes of the split button:
91
- *
92
- * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
93
- * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
94
- *
95
- * @readonly
96
- * @member {module:utils/keystrokehandler~KeystrokeHandler}
97
- */
98
- this.keystrokes = new KeystrokeHandler();
99
-
100
- /**
101
- * Tracks information about DOM focus in the dropdown.
102
- *
103
- * @readonly
104
- * @member {module:utils/focustracker~FocusTracker}
105
- */
106
- this.focusTracker = new FocusTracker();
107
-
108
- this.setTemplate( {
109
- tag: 'div',
110
-
111
- attributes: {
112
- class: [
113
- 'ck',
114
- 'ck-splitbutton',
115
- bind.to( 'class' ),
116
- bind.if( 'isVisible', 'ck-hidden', value => !value ),
117
- this.arrowView.bindTemplate.if( 'isOn', 'ck-splitbutton_open' )
118
- ]
119
- },
120
-
121
- children: this.children
122
- } );
123
- }
124
-
125
- /**
126
- * @inheritDoc
127
- */
128
- render() {
129
- super.render();
130
-
131
- this.children.add( this.actionView );
132
- this.children.add( this.arrowView );
133
-
134
- this.focusTracker.add( this.actionView.element );
135
- this.focusTracker.add( this.arrowView.element );
136
-
137
- this.keystrokes.listenTo( this.element );
138
-
139
- // Overrides toolbar focus cycling behavior.
140
- this.keystrokes.set( 'arrowright', ( evt, cancel ) => {
141
- if ( this.focusTracker.focusedElement === this.actionView.element ) {
142
- this.arrowView.focus();
143
-
144
- cancel();
145
- }
146
- } );
147
-
148
- // Overrides toolbar focus cycling behavior.
149
- this.keystrokes.set( 'arrowleft', ( evt, cancel ) => {
150
- if ( this.focusTracker.focusedElement === this.arrowView.element ) {
151
- this.actionView.focus();
152
-
153
- cancel();
154
- }
155
- } );
156
- }
157
-
158
- /**
159
- * @inheritDoc
160
- */
161
- destroy() {
162
- super.destroy();
163
-
164
- this.focusTracker.destroy();
165
- this.keystrokes.destroy();
166
- }
167
-
168
- /**
169
- * Focuses the {@link #actionView#element} of the action part of split button.
170
- */
171
- focus() {
172
- this.actionView.focus();
173
- }
174
-
175
- /**
176
- * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
177
- * attributes.
178
- *
179
- * @private
180
- * @returns {module:ui/button/buttonview~ButtonView}
181
- */
182
- _createActionView() {
183
- const actionView = new ButtonView();
184
-
185
- actionView.bind(
186
- 'icon',
187
- 'isEnabled',
188
- 'isOn',
189
- 'isToggleable',
190
- 'keystroke',
191
- 'label',
192
- 'tabindex',
193
- 'tooltip',
194
- 'tooltipPosition',
195
- 'type',
196
- 'withText'
197
- ).to( this );
198
-
199
- actionView.extendTemplate( {
200
- attributes: {
201
- class: 'ck-splitbutton__action'
202
- }
203
- } );
204
-
205
- actionView.delegate( 'execute' ).to( this );
206
-
207
- return actionView;
208
- }
209
-
210
- /**
211
- * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
212
- * attributes.
213
- *
214
- * @private
215
- * @returns {module:ui/button/buttonview~ButtonView}
216
- */
217
- _createArrowView() {
218
- const arrowView = new ButtonView();
219
- const bind = arrowView.bindTemplate;
220
-
221
- arrowView.icon = dropdownArrowIcon;
222
-
223
- arrowView.extendTemplate( {
224
- attributes: {
225
- class: [
226
- 'ck-splitbutton__arrow'
227
- ],
228
- 'data-cke-tooltip-disabled': bind.to( 'isOn' ),
229
- 'aria-haspopup': true,
230
- 'aria-expanded': bind.to( 'isOn', value => String( value ) )
231
- }
232
- } );
233
-
234
- arrowView.bind( 'isEnabled' ).to( this );
235
- arrowView.bind( 'label' ).to( this );
236
- arrowView.bind( 'tooltip' ).to( this );
237
-
238
- arrowView.delegate( 'execute' ).to( this, 'open' );
239
-
240
- return arrowView;
241
- }
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ constructor(locale) {
39
+ super(locale);
40
+ const bind = this.bindTemplate;
41
+ // Implement the Button interface.
42
+ this.set('class', undefined);
43
+ this.set('labelStyle', undefined);
44
+ this.set('icon', undefined);
45
+ this.set('isEnabled', true);
46
+ this.set('isOn', false);
47
+ this.set('isToggleable', false);
48
+ this.set('isVisible', true);
49
+ this.set('keystroke', undefined);
50
+ this.set('withKeystroke', false);
51
+ this.set('label', undefined);
52
+ this.set('tabindex', -1);
53
+ this.set('tooltip', false);
54
+ this.set('tooltipPosition', 's');
55
+ this.set('type', 'button');
56
+ this.set('withText', false);
57
+ /**
58
+ * Collection of the child views inside of the split button {@link #element}.
59
+ *
60
+ * @readonly
61
+ * @member {module:ui/viewcollection~ViewCollection}
62
+ */
63
+ this.children = this.createCollection();
64
+ /**
65
+ * A main button of split button.
66
+ *
67
+ * @readonly
68
+ * @member {module:ui/button/buttonview~ButtonView}
69
+ */
70
+ this.actionView = this._createActionView();
71
+ /**
72
+ * A secondary button of split button that opens dropdown.
73
+ *
74
+ * @readonly
75
+ * @member {module:ui/button/buttonview~ButtonView}
76
+ */
77
+ this.arrowView = this._createArrowView();
78
+ /**
79
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
80
+ * keystrokes of the split button:
81
+ *
82
+ * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
83
+ * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
84
+ *
85
+ * @readonly
86
+ * @member {module:utils/keystrokehandler~KeystrokeHandler}
87
+ */
88
+ this.keystrokes = new KeystrokeHandler();
89
+ /**
90
+ * Tracks information about DOM focus in the dropdown.
91
+ *
92
+ * @readonly
93
+ * @member {module:utils/focustracker~FocusTracker}
94
+ */
95
+ this.focusTracker = new FocusTracker();
96
+ this.setTemplate({
97
+ tag: 'div',
98
+ attributes: {
99
+ class: [
100
+ 'ck',
101
+ 'ck-splitbutton',
102
+ bind.to('class'),
103
+ bind.if('isVisible', 'ck-hidden', value => !value),
104
+ this.arrowView.bindTemplate.if('isOn', 'ck-splitbutton_open')
105
+ ]
106
+ },
107
+ children: this.children
108
+ });
109
+ }
110
+ /**
111
+ * @inheritDoc
112
+ */
113
+ render() {
114
+ super.render();
115
+ this.children.add(this.actionView);
116
+ this.children.add(this.arrowView);
117
+ this.focusTracker.add(this.actionView.element);
118
+ this.focusTracker.add(this.arrowView.element);
119
+ this.keystrokes.listenTo(this.element);
120
+ // Overrides toolbar focus cycling behavior.
121
+ this.keystrokes.set('arrowright', (evt, cancel) => {
122
+ if (this.focusTracker.focusedElement === this.actionView.element) {
123
+ this.arrowView.focus();
124
+ cancel();
125
+ }
126
+ });
127
+ // Overrides toolbar focus cycling behavior.
128
+ this.keystrokes.set('arrowleft', (evt, cancel) => {
129
+ if (this.focusTracker.focusedElement === this.arrowView.element) {
130
+ this.actionView.focus();
131
+ cancel();
132
+ }
133
+ });
134
+ }
135
+ /**
136
+ * @inheritDoc
137
+ */
138
+ destroy() {
139
+ super.destroy();
140
+ this.focusTracker.destroy();
141
+ this.keystrokes.destroy();
142
+ }
143
+ /**
144
+ * Focuses the {@link #actionView#element} of the action part of split button.
145
+ */
146
+ focus() {
147
+ this.actionView.focus();
148
+ }
149
+ /**
150
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
151
+ * attributes.
152
+ *
153
+ * @private
154
+ * @returns {module:ui/button/buttonview~ButtonView}
155
+ */
156
+ _createActionView() {
157
+ const actionView = new ButtonView();
158
+ actionView.bind('icon', 'isEnabled', 'isOn', 'isToggleable', 'keystroke', 'label', 'tabindex', 'tooltip', 'tooltipPosition', 'type', 'withText').to(this);
159
+ actionView.extendTemplate({
160
+ attributes: {
161
+ class: 'ck-splitbutton__action'
162
+ }
163
+ });
164
+ actionView.delegate('execute').to(this);
165
+ return actionView;
166
+ }
167
+ /**
168
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
169
+ * attributes.
170
+ *
171
+ * @private
172
+ * @returns {module:ui/button/buttonview~ButtonView}
173
+ */
174
+ _createArrowView() {
175
+ const arrowView = new ButtonView();
176
+ const bind = arrowView.bindTemplate;
177
+ arrowView.icon = dropdownArrowIcon;
178
+ arrowView.extendTemplate({
179
+ attributes: {
180
+ class: [
181
+ 'ck-splitbutton__arrow'
182
+ ],
183
+ 'data-cke-tooltip-disabled': bind.to('isOn'),
184
+ 'aria-haspopup': true,
185
+ 'aria-expanded': bind.to('isOn', value => String(value))
186
+ }
187
+ });
188
+ arrowView.bind('isEnabled').to(this);
189
+ arrowView.bind('label').to(this);
190
+ arrowView.bind('tooltip').to(this);
191
+ arrowView.delegate('execute').to(this, 'open');
192
+ return arrowView;
193
+ }
242
194
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
@@ -2,14 +2,11 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/dropdown/dropdownpanelview
8
7
  */
9
-
10
8
  import View from '../view';
11
9
  import { logWarning } from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
12
-
13
10
  /**
14
11
  * The dropdown panel view class.
15
12
  *
@@ -18,113 +15,105 @@ import { logWarning } from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
18
15
  * @extends module:ui/view~View
19
16
  */
20
17
  export default class DropdownPanelView extends View {
21
- /**
22
- * @inheritDoc
23
- */
24
- constructor( locale ) {
25
- super( locale );
26
-
27
- const bind = this.bindTemplate;
28
-
29
- /**
30
- * Controls whether the panel is visible.
31
- *
32
- * @observable
33
- * @member {Boolean} #isVisible
34
- */
35
- this.set( 'isVisible', false );
36
-
37
- /**
38
- * The position of the panel, relative to the parent.
39
- *
40
- * This property is reflected in the CSS class set to {@link #element} that controls
41
- * the position of the panel.
42
- *
43
- * @observable
44
- * @default 'se'
45
- * @member {'s'|'se'|'sw'|'sme'|'smw'|'n'|'ne'|'nw'|'nme'|'nmw'} #position
46
- */
47
- this.set( 'position', 'se' );
48
-
49
- /**
50
- * Collection of the child views in this panel.
51
- *
52
- * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
53
- * See {@link module:ui/dropdown/utils~addListToDropdown} and
54
- * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
55
- *
56
- * @readonly
57
- * @member {module:ui/viewcollection~ViewCollection}
58
- */
59
- this.children = this.createCollection();
60
-
61
- this.setTemplate( {
62
- tag: 'div',
63
-
64
- attributes: {
65
- class: [
66
- 'ck',
67
- 'ck-reset',
68
- 'ck-dropdown__panel',
69
- bind.to( 'position', value => `ck-dropdown__panel_${ value }` ),
70
- bind.if( 'isVisible', 'ck-dropdown__panel-visible' )
71
- ]
72
- },
73
-
74
- children: this.children,
75
-
76
- on: {
77
- // Drag and drop in the panel should not break the selection in the editor.
78
- // https://github.com/ckeditor/ckeditor5-ui/issues/228
79
- selectstart: bind.to( evt => evt.preventDefault() )
80
- }
81
- } );
82
- }
83
-
84
- /**
85
- * Focuses the first view in the {@link #children} collection.
86
- *
87
- * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
88
- */
89
- focus() {
90
- if ( this.children.length ) {
91
- if ( typeof this.children.first.focus === 'function' ) {
92
- this.children.first.focus();
93
- } else {
94
- /**
95
- * The child view of a dropdown could not be focused because it is missing the `focus()` method.
96
- *
97
- * This warning appears when a dropdown {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open} and it
98
- * attempts to focus the {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children first child} of its panel
99
- * but the child does not implement the
100
- * {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable focusable interface}.
101
- *
102
- * Focusing the content of a dropdown on open greatly improves the accessibility. Please make sure the view instance
103
- * provides the `focus()` method for the best user experience.
104
- *
105
- * @error ui-dropdown-panel-focus-child-missing-focus
106
- * @param {module:ui/view~View} childView
107
- * @param {module:ui/dropdown/dropdownpanelview~DropdownPanelView} dropdownPanel
108
- */
109
- logWarning( 'ui-dropdown-panel-focus-child-missing-focus', { childView: this.children.first, dropdownPanel: this } );
110
- }
111
- }
112
- }
113
-
114
- /**
115
- * Focuses the view element or last item in view collection on opening dropdown's panel.
116
- *
117
- * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
118
- */
119
- focusLast() {
120
- if ( this.children.length ) {
121
- const lastChild = this.children.last;
122
-
123
- if ( typeof lastChild.focusLast === 'function' ) {
124
- lastChild.focusLast();
125
- } else {
126
- lastChild.focus();
127
- }
128
- }
129
- }
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ constructor(locale) {
22
+ super(locale);
23
+ const bind = this.bindTemplate;
24
+ /**
25
+ * Controls whether the panel is visible.
26
+ *
27
+ * @observable
28
+ * @member {Boolean} #isVisible
29
+ */
30
+ this.set('isVisible', false);
31
+ /**
32
+ * The position of the panel, relative to the parent.
33
+ *
34
+ * This property is reflected in the CSS class set to {@link #element} that controls
35
+ * the position of the panel.
36
+ *
37
+ * @observable
38
+ * @default 'se'
39
+ * @member {'s'|'se'|'sw'|'sme'|'smw'|'n'|'ne'|'nw'|'nme'|'nmw'} #position
40
+ */
41
+ this.set('position', 'se');
42
+ /**
43
+ * Collection of the child views in this panel.
44
+ *
45
+ * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
46
+ * See {@link module:ui/dropdown/utils~addListToDropdown} and
47
+ * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
48
+ *
49
+ * @readonly
50
+ * @member {module:ui/viewcollection~ViewCollection}
51
+ */
52
+ this.children = this.createCollection();
53
+ this.setTemplate({
54
+ tag: 'div',
55
+ attributes: {
56
+ class: [
57
+ 'ck',
58
+ 'ck-reset',
59
+ 'ck-dropdown__panel',
60
+ bind.to('position', value => `ck-dropdown__panel_${value}`),
61
+ bind.if('isVisible', 'ck-dropdown__panel-visible')
62
+ ]
63
+ },
64
+ children: this.children,
65
+ on: {
66
+ // Drag and drop in the panel should not break the selection in the editor.
67
+ // https://github.com/ckeditor/ckeditor5-ui/issues/228
68
+ selectstart: bind.to(evt => evt.preventDefault())
69
+ }
70
+ });
71
+ }
72
+ /**
73
+ * Focuses the first view in the {@link #children} collection.
74
+ *
75
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
76
+ */
77
+ focus() {
78
+ if (this.children.length) {
79
+ const firstChild = this.children.first;
80
+ if (typeof firstChild.focus === 'function') {
81
+ firstChild.focus();
82
+ }
83
+ else {
84
+ /**
85
+ * The child view of a dropdown could not be focused because it is missing the `focus()` method.
86
+ *
87
+ * This warning appears when a dropdown {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open} and it
88
+ * attempts to focus the {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children first child} of its panel
89
+ * but the child does not implement the
90
+ * {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable focusable interface}.
91
+ *
92
+ * Focusing the content of a dropdown on open greatly improves the accessibility. Please make sure the view instance
93
+ * provides the `focus()` method for the best user experience.
94
+ *
95
+ * @error ui-dropdown-panel-focus-child-missing-focus
96
+ * @param {module:ui/view~View} childView
97
+ * @param {module:ui/dropdown/dropdownpanelview~DropdownPanelView} dropdownPanel
98
+ */
99
+ logWarning('ui-dropdown-panel-focus-child-missing-focus', { childView: this.children.first, dropdownPanel: this });
100
+ }
101
+ }
102
+ }
103
+ /**
104
+ * Focuses the view element or last item in view collection on opening dropdown's panel.
105
+ *
106
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
107
+ */
108
+ focusLast() {
109
+ if (this.children.length) {
110
+ const lastChild = this.children.last;
111
+ if (typeof lastChild.focusLast === 'function') {
112
+ lastChild.focusLast();
113
+ }
114
+ else {
115
+ lastChild.focus();
116
+ }
117
+ }
118
+ }
130
119
  }