Fix and improve chat title edit #2285
Reference in New Issue
Block a user
Delete Branch "fix-chat-title-edit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now in prod, editing a chat title isn't a valid option from the chat or chat nav - they both result in a "Missing content" error. The existing edit form is also full of extra classes and has some odd behavior.
This PR:
autofocus: trueit doesBefore (once missing content was fixed) and after:

(edit: the background for the box is now
bg-transparentto blend in with the background, so this screenshot is slightly out of date)Question: Is this
data: { turbo_frame: dom_id(chat, "title") })pattern the correct way to do this? I know theMenuComponentis a custom component we have, I wasn't sure if there is supposed to be something that converts theframe: dom_id(chat, "title")to the turbo_frame within that component or not. This seems like an easy gotcha.So I actually think the problem here is embedded deeper in the
menu_item_component.rb. We're exposing a "button-like" API for the item, but not actually processing theframeoption at all.I believe this diff should fix the issue. I didn't adjust any styling, but worth calling out that the title can be edited from both the chat view and the index view (hence the
<% bg_class = params[:ctx] == "chat" ? "bg-container" : "bg-container-inset" %>to toggle the background based on that context)@zachgoll thanks for the diff! I needed to add the
frameas a parameter, but that did the trick. I moved the component usage back toframe:Yeah - I had both in my screenshot. I liked having the singular background for the text but justin clarified it should be more of a blend. I ended up going with
bg-transparentinstead so it always belnds and there isn't a need to do any matching.Ahh, the transparent background works even better! Looks good now.