Skip to content

Commit a537108

Browse files
committed
Added tooltips to actions
1 parent 9e1e6bd commit a537108

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSearchActions.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
MenuToggleElement,
1111
Select,
1212
SelectList,
13-
SelectOption
13+
SelectOption,
14+
Tooltip
1415
} from '@patternfly/react-core';
1516
import { FilterIcon, SortAmountDownIcon } from '@patternfly/react-icons';
1617

@@ -141,13 +142,15 @@ export const ChatbotHeaderTitleDemo: FunctionComponent = () => {
141142
isLoading={isLoading}
142143
searchActionStart={
143144
showSearchActionStart ? (
144-
<Button
145-
variant="control"
146-
aria-label="Filter options"
147-
// eslint-disable-next-line no-console
148-
onClick={() => console.log('Filter button clicked')}
149-
icon={<FilterIcon />}
150-
/>
145+
<Tooltip content="Filter options" aria="none" aria-live="off">
146+
<Button
147+
variant="control"
148+
aria-label="Filter options"
149+
// eslint-disable-next-line no-console
150+
onClick={() => console.log('Filter button clicked')}
151+
icon={<FilterIcon />}
152+
/>
153+
</Tooltip>
151154
) : undefined
152155
}
153156
searchActionEnd={
@@ -157,23 +160,26 @@ export const ChatbotHeaderTitleDemo: FunctionComponent = () => {
157160
isOpen={isSortSelectOpen}
158161
selected={selectedSort}
159162
onSelect={onSortSelect}
163+
shouldFocusToggleOnSelect
160164
onOpenChange={(isOpen) => setIsSortSelectOpen(isOpen)}
161165
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
162-
<MenuToggle
163-
ref={toggleRef}
164-
onClick={() => setIsSortSelectOpen(!isSortSelectOpen)}
165-
isExpanded={isSortSelectOpen}
166-
variant="plain"
167-
aria-label={`${sortLabels[selectedSort]}, Sort conversations`}
168-
icon={
169-
<SortAmountDownIcon
170-
style={{
171-
transform:
172-
selectedSort === 'oldest' || selectedSort === 'alphabetical-asc' ? 'scaleY(-1)' : 'none'
173-
}}
174-
/>
175-
}
176-
/>
166+
<Tooltip aria="none" aria-live="off" content={`Sort - ${sortLabels[selectedSort]}`}>
167+
<MenuToggle
168+
ref={toggleRef}
169+
onClick={() => setIsSortSelectOpen(!isSortSelectOpen)}
170+
isExpanded={isSortSelectOpen}
171+
variant="plain"
172+
aria-label={`${sortLabels[selectedSort]}, Sort conversations`}
173+
icon={
174+
<SortAmountDownIcon
175+
style={{
176+
transform:
177+
selectedSort === 'oldest' || selectedSort === 'alphabetical-asc' ? 'scaleY(-1)' : 'none'
178+
}}
179+
/>
180+
}
181+
/>
182+
</Tooltip>
177183
)}
178184
>
179185
<SelectList>

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ import SettingsForm from '@patternfly/chatbot/dist/dynamic/Settings';
7373
import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon, ThumbtackIcon, UploadIcon } from '@patternfly/react-icons';
7474
import { useDropzone } from 'react-dropzone';
7575

76-
import ChatbotConversationHistoryNav, { Conversation } from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
77-
import { Button, DropdownItem, DropdownList, Checkbox, MenuToggle, MenuToggleElement, Select, SelectList, SelectOption } from '@patternfly/react-core';
76+
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
77+
import { Button, DropdownItem, DropdownList, Checkbox, MenuToggle, Select, SelectList, SelectOption } from '@patternfly/react-core';
7878

7979
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
8080
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';

0 commit comments

Comments
 (0)