You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi it's me again, and back at it with JSX Modals, this time it's the "required" prop, omitting it or especially setting it required={false} still makes the modal component required to interact with, same example as my previous issue:
import{ChatInputCommand,CommandData,Label,Modal,StringSelectMenu,StringSelectMenuOption,TextInput,UserSelectMenu}from"commandkit";import{ApplicationCommandOptionType,TextInputStyle}from"discord.js";exportconstcommand: CommandData={name: "movement",description: "Issue a Staff Movement on a member",options: [{name: "target",description: "Who is the target of this command?",type: ApplicationCommandOptionType.User,required: true}]}exportconstchatInput: ChatInputCommand=async({ interaction })=>{consttarget=interaction.options.getUser("target",true)constcorrectModal=(<Modaltitle="Staff Movement Selection"customId="staffmovemententrymodal"><Labellabel="Member"description="The target of the command"><UserSelectMenucustomId="member"minValues={1}maxValues={1}defaultValues={[target.id]}required/></Label><Labellabel="Movement Type"><StringSelectMenucustomId="type"minValues={1}maxValues={1}>// Prop not present, yet field is required<StringSelectMenuOptionlabel="Warning"value="warning"/><StringSelectMenuOptionlabel="Strike"value="strike"/><StringSelectMenuOptionlabel="Suspension"description="Use it to initiate investigations"value="suspension"/><StringSelectMenuOptionlabel="Termination"value="termination"/><StringSelectMenuOptionlabel="Termination & Staff Blacklist"description="Use this for staff members that need to be blacklisted and terminated"value="termandbl"/><StringSelectMenuOptionlabel="Staff Blacklist"description="Use this for non-staff members that need to be blacklisted"value="blacklist"/><StringSelectMenuOptionlabel="Rank Movement"description="Promotions & Demotions, auto selected"value="rankmovement"/><StringSelectMenuOptionlabel="Reinstatement"value="reinstatement"/><StringSelectMenuOptionlabel="Retirement"value="retirement"/></StringSelectMenu></Label><Labellabel="Reason"><TextInputcustomId="reason"style={TextInputStyle.Paragraph}required={false}/>// <- Here, set to false</Label><Labellabel="Text Proof"><TextInputcustomId="textproof"style={TextInputStyle.Paragraph}/>// <- Prop omitted</Label></Modal>)awaitinteraction.showModal(correctModal)return;}
Note
Setting "required" to any false-ish value (0, null) still provokes the field to become required, here's the modal in discord
Weirdly enough, in packages/commandkit/src/components/interactive/modal/Modal.ts
The textinput props seem to pass in the required field just like all the others, I have no idea what can cause this behavior
exportinterfaceTextInputProps{customId: string;/** * @deprecated use the `<Label />` component instead. */label?: string;placeholder?: string;maxLength?: number;minLength?: number;value?: string;required?: boolean;}/** * The text input component. * @param props The text input properties. * @returns The commandkit element. * @example <TextInput customId="input" style={TextInputStyle.Short} /> */exportfunctionTextInput(props: TextInputProps&{style: TextInputStyle},): CommandKitElement<'text-input'>{constinput=newTextInputBuilder().setStyle(props.style);if(props.customId){input.setCustomId(props.customId);}if(props.label){warnDeprecated({what: 'Property `label`',where: '<TextInput />',message: 'Use the <Label /> component instead.',});input.setLabel(props.label);}if(props.placeholder){input.setPlaceholder(props.placeholder);}if(props.maxLength){input.setMaxLength(props.maxLength);}if(props.minLength){input.setMinLength(props.minLength);}if(props.value){input.setValue(props.value);}if(props.required){input.setRequired(props.required);}returninput;}
Hi it's me again, and back at it with JSX Modals, this time it's the "required" prop, omitting it or especially setting it required={false} still makes the modal component required to interact with, same example as my previous issue:
Note
Setting "required" to any false-ish value (0, null) still provokes the field to become required, here's the modal in discord
Weirdly enough, in packages/commandkit/src/components/interactive/modal/Modal.ts
The textinput props seem to pass in the required field just like all the others, I have no idea what can cause this behavior