-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Duplicate bots panel for "Personal" tab to fix keyboard navigation. #37010
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
base: main
Are you sure you want to change the base?
Conversation
|
@shubham-padia can you do maintainer review on this one? |
|
The settings header is now |
shubham-padia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great in testing! Only behavioural thing I could notice was the BotsBots thing mentioned in another comment.
Left some comments mostly focusing on deduplication.
| #admin-user-list, | ||
| #admin-bot-list { | ||
| #admin-bot-list, | ||
| #personal-bot-list { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's worth the extra effort on a less-touched part of the codebase, but I think it would be better to have a prefix agnostic selector here instead of duplicating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to refactor the classes and ID names later mainly because admin-bot-list does not seem correct since it is actionable for non-admins as well. So, I think we can handle this then.
| $(".personal-bot-settings-switcher"), | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can also deduplicate b/w show_personal_bot_settings_toggler and show_org_bot_settings_toggler by accepting a prefix and a toggler instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added show_bot_settings_toggler function for this.
| } | ||
| $(`[data-bot-settings-section="${CSS.escape(key)}"]`).show(); | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be deduplicating the toggle creating logic. We could accept a prefix and a function to set the settings_tab e.g. set_bot_personal_settings_tab. Another comment of mine also proposes changing that function such that it accepts a prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added function to deduplicate creating logic as well.
web/src/settings_panel_menu.ts
Outdated
| this.current_tab = this.$curr_li.attr("data-section")!; | ||
| this.current_user_settings_tab = "active"; | ||
| this.current_bot_settings_tab = "all-bots"; | ||
| this.current_bot_personal_settings_tab = "your-bots"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking whether we could have
this.current_bot_settings_tab = {
"personal": "your-bots",
"org": "all-bots"
}
Then we can change the set settings tab to pass prefix as well and we won't need two set settings tab functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't end up doing this, we should look at renaming instances of bot_settings which actually mean org_bot_settings e.g. current_bot_settings_tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this change of current_bot_settings_tab being an object.
| } | ||
| if (personal_your_bots_section.list_widget) { | ||
| personal_your_bots_section.list_widget.replace_list_data(bot_user_ids_for_current_owner); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we end up redrawing personal bots section when redrawing org your bots section always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, we have four separate ListWidget, two ("Your bots" and "All bots") each for "Personal" and "Organization" and we redraw them only if they have been set up once previously.
|
last commit has typo in |
2abd46e to
fc237d1
Compare
|
Made the changes as per feedback. Posted replies to the comments as well. I also remember to update the lock-icon behavior in the left panel, will push update for that soon. |
|
Added a commit to fix lock icon to not be shown when user can either create bots or can manage any bot as discussed on CZO. Also updated the tooltip for the lock icon to be |
shubham-padia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just need to clarify one question, rest should be fine.
| drafts.initialize(); // Must happen before reload_setup.initialize() | ||
| reload_setup.initialize(); | ||
| unread.initialize(state_data.unread); | ||
| bot_data.initialize(state_data.bot); // Must happen after people.initialize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we move this up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to call this before settings.initialize so that lock icon can be shown for a non-admin correctly based on if they own any bot to manage or not. I will add a comment on that.
We always pass a string value to set_bot_settings_tab in settings_panel_menu.ts, so we can update the type of variable to "string" from "string | undefined".
We previously showed lock icon for "Bots" panel in left sidebar when user was not allowed to create new bots even when user could manage other bots. This commit updates that to not show lock icon when the user can manage bots as the panel is still useful to that user. Also updated the tooltip to be more clear about what permission the user doesn't have.
This commit does some preparatory work for duplicating bots panel in "Personal" tab, i.e. we do not redirect to the "Organization" tab bots panel when clicking on bots panel in "Personal" tab. The changes done are - - Updated IDs in templates to have a prefix so that the same template can be reused without duplicate IDs. - Added classes to some elements so that it is easy to query them using class selectors instead of ID. - Updated JS code to rename variables and function declarations to accept container elements and/or section so that same JS code can be used for both bot panels. - Did some changes in settings_panel_menu.ts to support same "section" value for sections in "Personal" and "Organization" tabs. - Updated tab related code in settings_panel_menu.ts to support two bot panels. And also updated the toggler related code so that we can avoid code duplication when using togglers for two bot panels.
Previously, clicking on "Bots" in "Personal" tab redirected to bots panel in "Organization" tab. This commit changes this behavior to not redirect and instead show the same content shown in bots panel in "Organization" tab in the "Personal" tab and opening "Your bots" section by default instead of "All bots". Now "Bots" in both "Personal" and "Organization" opens different sections independent of each other maintaining their individual filter and search value selected. This helps in maintaining the keyboard navigation using up/down keys in the settings sidebar which was broken due to redirecting. We also now show lock icon for the personal bots panel if user does not have permission to create or manage bots like we do for organization bots panel.
|
Looks good! |
|
Works for me in manual testing! By the way, since I was playing with keyboard nav, I noticed that pressing "Enter" on "All bots" or "Your bots" tabs doesn't work -- the focus just bounces to the "Add a new bot" button without switching panels. Not sure if this is known? |
|
It is same for the users panel as well where focus bounces on the role dropdown. Will investigate. |
Fixes:
Screenshots and screen captures:
Screencast.from.2025-12-11.15-45-32.webm
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: