Skip to content

Commit eaf2758

Browse files
bnavettajasonkeungoz-agent
authored
Fix agent dropdown rendering in new API key modal (#11187)
## Description This fixes a rendering bug in the API key creation modal. The modal content was showing through the dropdown to select which agent the key is for. The problem was that the agent dropdown menu renders as an overlay, but the modal is already an overlay. As a result, other modal content wouldn't render fully below the dropdown - rendering instead depends on the order that the UI framework processes elements in. Here, it would paint the collapsed exipry selector dropdown on top of the opened agent dropdown menu. This category of bugs has been a longstanding issue with the UI framework's z-index handling. As a workaround for now, we can: 1. Reserve space in the modal for the agent dropdown 2. Render the dropdown in a new `Stack` as an overlay that's painted after the other modal contents ## Testing - [x] I have manually tested my changes locally with `./script/run` ### Screenshots / Videos <img width="701" height="724" alt="Screenshot 2026-05-20 at 1 41 35 AM" src="https://github.com/user-attachments/assets/a910b308-db4b-4e6f-bdb0-7f827561781f" /> ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode --------- Co-authored-by: Jason Keung <jason@warp.dev> Co-authored-by: Oz <oz-agent@warp.dev>
1 parent 3bd21f8 commit eaf2758

1 file changed

Lines changed: 36 additions & 9 deletions

File tree

app/src/settings_view/platform/create_api_key_modal.rs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ use crate::workspaces::user_workspaces::UserWorkspaces;
66
use crate::{
77
appearance::Appearance,
88
editor::{EditorView, PropagateAndNoOpNavigationKeys, SingleLineEditorOptions, TextOptions},
9+
view_components::{dropdown::DROPDOWN_PADDING, dropdown::TOP_MENU_BAR_HEIGHT},
910
view_components::{Dropdown as DropdownView, DropdownItem},
1011
};
1112
use chrono::Utc;
1213
use pathfinder_geometry::vector::vec2f;
1314
use warp_core::features::FeatureFlag;
1415
use warpui::elements::{
15-
Border, ChildView, ConstrainedBox, Container, CornerRadius, Empty, Fill, Flex,
16-
MouseStateHandle, ParentElement, Radius, Text,
16+
Border, ChildAnchor, ChildView, ConstrainedBox, Container, CornerRadius, Empty, Fill, Flex,
17+
MouseStateHandle, OffsetPositioning, ParentElement, PositionedElementAnchor,
18+
PositionedElementOffsetBounds, Radius, SavePosition, Stack, Text,
1719
};
1820
use warpui::elements::{CrossAxisAlignment, Expanded, MainAxisAlignment, MainAxisSize, Padding};
1921
use warpui::ui_components::button::ButtonVariant;
@@ -29,6 +31,7 @@ const OZ_AGENTS_URL: &str = "https://oz.warp.dev/agents?new=true";
2931

3032
const LABEL_FONT_SIZE: f32 = 14.;
3133
const INPUT_WIDTH: f32 = 428.; // 460px - (2 * 16px) padding
34+
const AGENT_DROPDOWN_POSITION_ID: &str = "create_api_key_modal_agent_dropdown";
3235

3336
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3437
pub(crate) enum ApiKeyType {
@@ -166,7 +169,7 @@ impl CreateApiKeyModal {
166169
ctx.add_typed_action_view(DropdownView::<CreateApiKeyModalAction>::new);
167170
agent_dropdown.update(ctx, |dropdown, ctx| {
168171
dropdown.set_top_bar_max_width(INPUT_WIDTH);
169-
dropdown.set_menu_width(INPUT_WIDTH, ctx);
172+
dropdown.set_match_menu_width_to_top_bar(true, ctx);
170173
});
171174

172175
let api_key_type_control = ctx.add_typed_action_view(move |ctx| {
@@ -667,6 +670,7 @@ impl View for CreateApiKeyModal {
667670
.finish();
668671

669672
let mut col = Flex::column();
673+
let mut render_agent_dropdown = false;
670674

671675
if self.has_team || self.has_named_agents {
672676
let type_label =
@@ -738,13 +742,19 @@ impl View for CreateApiKeyModal {
738742
.finish(),
739743
);
740744
} else {
745+
render_agent_dropdown = true;
741746
col.add_child(
742-
ConstrainedBox::new(
743-
Container::new(ChildView::new(&self.agent_dropdown).finish())
744-
.with_margin_bottom(16.)
745-
.finish(),
747+
Container::new(
748+
SavePosition::new(
749+
ConstrainedBox::new(Empty::new().finish())
750+
.with_width(INPUT_WIDTH)
751+
.with_height(TOP_MENU_BAR_HEIGHT + (2. * DROPDOWN_PADDING))
752+
.finish(),
753+
AGENT_DROPDOWN_POSITION_ID,
754+
)
755+
.finish(),
746756
)
747-
.with_width(INPUT_WIDTH)
757+
.with_margin_bottom(16.)
748758
.finish(),
749759
);
750760
}
@@ -786,7 +796,24 @@ impl View for CreateApiKeyModal {
786796
);
787797

788798
col.add_child(buttons_row);
789-
col.finish()
799+
let mut stack = Stack::new()
800+
.with_constrain_absolute_children()
801+
.with_child(col.finish());
802+
if render_agent_dropdown {
803+
stack.add_positioned_overlay_child(
804+
ConstrainedBox::new(ChildView::new(&self.agent_dropdown).finish())
805+
.with_width(INPUT_WIDTH)
806+
.finish(),
807+
OffsetPositioning::offset_from_save_position_element(
808+
AGENT_DROPDOWN_POSITION_ID,
809+
vec2f(0., 0.),
810+
PositionedElementOffsetBounds::WindowByPosition,
811+
PositionedElementAnchor::TopLeft,
812+
ChildAnchor::TopLeft,
813+
),
814+
);
815+
}
816+
stack.finish()
790817
}
791818
}
792819
}

0 commit comments

Comments
 (0)