Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tooltip of base section list #33580

Merged
merged 10 commits into from
Jan 12, 2024
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
Loading