Skip to content

Commit

Permalink
Merge pull request #33580 from dukenv0307/fix/33172
Browse files Browse the repository at this point in the history
Remove tooltip of base section list
  • Loading branch information
Hayata Suenaga authored Jan 12, 2024
2 parents 176fb00 + c7f49b2 commit f6a2e78
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseSelectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function BaseSelectionList({
disableKeyboardShortcuts = false,
children,
shouldStopPropagation = false,
shouldShowTooltips = true,
shouldUseDynamicMaxToRenderPerBatch = false,
rightHandSideComponent,
}) {
Expand Down Expand Up @@ -304,7 +305,7 @@ function BaseSelectionList({
const isDisabled = section.isDisabled || item.isDisabled;
const isItemFocused = !isDisabled && focusedIndex === normalizedIndex;
// We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade.
const showTooltip = normalizedIndex < 10;
const showTooltip = shouldShowTooltips && normalizedIndex < 10;

return (
<BaseListItem
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/selectionListPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ const propTypes = {
/** Custom content to display in the footer */
footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),

/** Whether to show the toolip text */
shouldShowTooltips: PropTypes.bool,

/** Whether to use dynamic maxToRenderPerBatch depending on the visible number of elements */
shouldUseDynamicMaxToRenderPerBatch: PropTypes.bool,

Expand Down
7 changes: 6 additions & 1 deletion src/components/ValuePicker/ValueSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const propTypes = {

/** Function to call when the user closes the modal */
onClose: PropTypes.func,

/** Whether to show the toolip text */
shouldShowTooltips: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -34,9 +37,10 @@ const defaultProps = {
label: '',
onClose: () => {},
onItemSelected: () => {},
shouldShowTooltips: true,
};

function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onItemSelected}) {
function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onItemSelected, shouldShowTooltips}) {
const styles = useThemeStyles();
const [sectionsData, setSectionsData] = useState([]);

Expand Down Expand Up @@ -69,6 +73,7 @@ function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onI
onSelectRow={onItemSelected}
initiallyFocusedOptionKey={selectedItem.value}
shouldStopPropagation
shouldShowTooltips={shouldShowTooltips}
/>
</ScreenWrapper>
</Modal>
Expand Down
7 changes: 6 additions & 1 deletion src/components/ValuePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const propTypes = {

/** A ref to forward to MenuItemWithTopDescription */
forwardedRef: refPropTypes,

/** Whether to show the toolip text */
shouldShowTooltips: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -45,9 +48,10 @@ const defaultProps = {
errorText: '',
furtherDetails: undefined,
onInputChange: () => {},
shouldShowTooltips: true,
};

function ValuePicker({value, label, items, placeholder, errorText, onInputChange, furtherDetails, forwardedRef}) {
function ValuePicker({value, label, items, placeholder, errorText, onInputChange, furtherDetails, shouldShowTooltips, forwardedRef}) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const [isPickerVisible, setIsPickerVisible] = useState(false);
Expand Down Expand Up @@ -92,6 +96,7 @@ function ValuePicker({value, label, items, placeholder, errorText, onInputChange
items={items}
onClose={hidePickerModal}
onItemSelected={updateInput}
shouldShowTooltips={shouldShowTooltips}
/>
</View>
);
Expand Down
1 change: 1 addition & 0 deletions src/pages/settings/Profile/TimezoneSelectPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function TimezoneSelectPage(props) {
sections={[{data: timezoneOptions, indexOffset: 0, isDisabled: timezone.automatic}]}
initiallyFocusedOptionKey={_.get(_.filter(timezoneOptions, (tz) => tz.text === timezone.selected)[0], 'keyForList')}
showScrollIndicator
shouldShowTooltips={false}
/>
</ScreenWrapper>
);
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceNewRoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ function WorkspaceNewRoomPage(props) {
onValueChange={setVisibility}
value={visibility}
furtherDetails={visibilityDescription}
shouldShowTooltips={false}
/>
</View>
</FormProvider>
Expand Down

0 comments on commit f6a2e78

Please sign in to comment.