Skip to content

ADFA-3717: Render inactive toolbar actions as disabled instead of hidden#1181

Open
Daniel-ADFA wants to merge 1 commit intostagefrom
ADFA-3717
Open

ADFA-3717: Render inactive toolbar actions as disabled instead of hidden#1181
Daniel-ADFA wants to merge 1 commit intostagefrom
ADFA-3717

Conversation

@Daniel-ADFA
Copy link
Copy Markdown
Contributor

@Daniel-ADFA Daniel-ADFA commented Apr 14, 2026

Screen_recording_20260414_230923.webm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Toolbar Action Visibility Changes

  • Modified toolbar action filtering logic: Inactive toolbar actions are now rendered as disabled (visually dimmed with reduced alpha) instead of being completely hidden from the toolbar
    • Changed condition in EditorHandlerActivity.prepareOptionsMenu() from if (action.id in hiddenIds || !action.visible) to if (action.id in hiddenIds)
    • Non-hidden but inactive actions now proceed through icon/color setup and are added to the toolbar with disabled appearance (alpha set to 76)

Risk Assessment

⚠️ Behavior Change: Actions that were previously hidden will now be visible but disabled. This could affect:

  • User discoverability: Users may see disabled actions they couldn't see before
  • UI/UX expectations: Applications relying on action visibility as a filtering mechanism may display unexpected UI elements
  • Accessibility: Disabled toolbar items may impact screen reader behavior or keyboard navigation

Best Practice Concern: This represents a semantic shift in how action.visible is interpreted - from a filtering criterion to purely a state indicator. Ensure this change aligns with the action API contract and that all action implementations consistently set the visible property to reflect actual availability rather than intended visibility.

Walkthrough

A filtering condition in the toolbar menu construction logic of EditorHandlerActivity.prepareOptionsMenu() was modified to skip only actions whose id is in hiddenIds, removing the previous check that also excluded non-visible actions. Non-hidden actions now proceed regardless of visibility status.

Changes

Cohort / File(s) Summary
Menu Action Filtering Logic
app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt
Modified action filtering condition to exclude only hidden actions by id, allowing non-visible actions to be processed and added to the toolbar menu.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A tweak so small, a filter's dance,
Hidden actions lose their chance,
Yet invisible ones now show their might,
In toolbars gleaming, bold and bright! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, making it impossible to evaluate relevance to the changeset. Add a description explaining the motivation for rendering inactive actions as disabled and any relevant context or testing performed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: modifying action filtering logic to render inactive toolbar actions as disabled rather than hidden.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3717

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt (1)

434-444: ⚠️ Potential issue | 🟠 Major

Do not allow visible=false actions to remain executable from the toolbar.

After removing the visibility gate, any action with visible=false but enabled=true can now render and execute via toolbar click. That breaks the UI/behavior contract. If the goal is “show inactive actions as disabled,” compute a UI-enabled state from both flags and gate alpha/click with it.

Suggested patch
 			action.prepare(data)

 			if (action.id in hiddenIds) return@onEachIndexed
+			val isUiEnabled = action.visible && action.enabled

 			action.icon?.apply {
 				colorFilter = action.createColorFilter(data)
-				alpha = if (action.enabled) 255 else 76
+				alpha = if (isUiEnabled) 255 else 76
 			}

 			content.projectActionsToolbar.addMenuItem(
 				icon = action.icon,
 				hint = getToolbarContentDescription(action, data),
-				onClick = { if (action.enabled) registry.executeAction(action, data) },
+				onClick = { if (isUiEnabled) registry.executeAction(action, data) },

Based on learnings: in app/src/main/java/com/itsaky/androidide/shortcuts/IdeShortcutActions.kt, visible is intentionally UI-only while enabled governs execution, so execution should not bypass UI visibility semantics.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt`
around lines 434 - 444, The toolbar currently lets actions with visible=false
but enabled=true be clicked; change the UI logic to compute a UI-enabled flag
(e.g., val uiEnabled = action.visible && action.enabled) and use that for
rendering and click gating: apply the alpha based on uiEnabled (255 vs 76) and
change the onClick to guard with uiEnabled before calling
registry.executeAction(action, data). Keep the existing hiddenIds check
(action.id in hiddenIds) as-is to still omit fully hidden items; update
references in the projectActionsToolbar.addMenuItem call and any uses of
action.enabled in this block to use uiEnabled instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt`:
- Around line 434-444: The toolbar currently lets actions with visible=false but
enabled=true be clicked; change the UI logic to compute a UI-enabled flag (e.g.,
val uiEnabled = action.visible && action.enabled) and use that for rendering and
click gating: apply the alpha based on uiEnabled (255 vs 76) and change the
onClick to guard with uiEnabled before calling registry.executeAction(action,
data). Keep the existing hiddenIds check (action.id in hiddenIds) as-is to still
omit fully hidden items; update references in the
projectActionsToolbar.addMenuItem call and any uses of action.enabled in this
block to use uiEnabled instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e67292d9-4db5-4d8a-804f-6ff85cbc6229

📥 Commits

Reviewing files that changed from the base of the PR and between 8787677 and 22b9e63.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants