From 4d42c83f57698a9c771d2e1fd81d0404884dd9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Chrze=C5=9Bcian?= Date: Tue, 15 Dec 2020 16:36:44 +0100 Subject: [PATCH 1/2] Custom tooltip position for grouped items in toolbar. --- packages/ckeditor5-ui/src/toolbar/toolbarview.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ckeditor5-ui/src/toolbar/toolbarview.js b/packages/ckeditor5-ui/src/toolbar/toolbarview.js index a9635f0c150..08f516e63df 100644 --- a/packages/ckeditor5-ui/src/toolbar/toolbarview.js +++ b/packages/ckeditor5-ui/src/toolbar/toolbarview.js @@ -863,6 +863,7 @@ class DynamicGrouping { dropdown.buttonView.set( { label: t( 'Show more items' ), tooltip: true, + tooltipPosition: locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw', icon: verticalDotsIcon } ); From b2db6fba66ff6c6e77b5d722f5d7313ee4a90d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Chrze=C5=9Bcian?= Date: Wed, 16 Dec 2020 15:50:29 +0100 Subject: [PATCH 2/2] Missing tests added. --- .../ckeditor5-ui/tests/toolbar/toolbarview.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/ckeditor5-ui/tests/toolbar/toolbarview.js b/packages/ckeditor5-ui/tests/toolbar/toolbarview.js index ffbc5e723f9..2e701961dea 100644 --- a/packages/ckeditor5-ui/tests/toolbar/toolbarview.js +++ b/packages/ckeditor5-ui/tests/toolbar/toolbarview.js @@ -997,6 +997,26 @@ describe( 'ToolbarView', () => { expect( groupedItemsDropdown.buttonView.label ).to.equal( 'Show more items' ); } ); + it( 'tooltip has the proper position depending on the UI language direction (LTR UI)', () => { + const locale = new Locale( { uiLanguage: 'en' } ); + const view = new ToolbarView( locale, { shouldGroupWhenFull: true } ); + view.render(); + + expect( view._behavior.groupedItemsDropdown.buttonView.tooltipPosition ).to.equal( 'sw' ); + + view.destroy(); + } ); + + it( 'tooltip has the proper position depending on the UI language direction (RTL UI)', () => { + const locale = new Locale( { uiLanguage: 'ar' } ); + const view = new ToolbarView( locale, { shouldGroupWhenFull: true } ); + view.render(); + + expect( view._behavior.groupedItemsDropdown.buttonView.tooltipPosition ).to.equal( 'se' ); + + view.destroy(); + } ); + it( 'shares its toolbarView#items with grouped items', () => { view.items.add( focusable() ); view.items.add( focusable() );