Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion frontend/apps/thunder-gate/src/components/SignUp/SignUpBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import {
ColorSchemeImage,
IconButton,
InputAdornment,
Select,
MenuItem,
} from '@wso2/oxygen-ui';
import {SignUp} from '@asgardeo/react';
import {Smartphone, Google, Facebook, GitHub, Eye, EyeClosed} from '@wso2/oxygen-ui-icons-react';
Expand Down Expand Up @@ -128,7 +130,7 @@ export default function SignUpBox(): JSX.Element {
const inputs: Record<string, string> = {};

form.components
?.filter((c: {type: string}) => c.type === 'INPUT')
?.filter((c: {type: string}) => c.type === 'INPUT' || c.type === 'SELECT')
.forEach((input: {config: {identifier: string}}) => {
if (input.config?.identifier) {
inputs[input.config.identifier] = data.get(input.config.identifier) as string;
Expand All @@ -154,9 +156,50 @@ export default function SignUpBox(): JSX.Element {
required: boolean;
hint: string;
text: string;
options?: string[];
};
variant: string;
}) => {
if (component.type === 'SELECT' && component.config?.options) {
return (
<FormControl key={component.id} fullWidth>
<FormLabel htmlFor={component.config?.identifier}>
{component.config?.label}
</FormLabel>
<Select
Comment on lines +166 to +169
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

The Select component is missing the labelId prop which should reference the FormLabel. This is important for proper accessibility and semantic HTML structure. The FormLabel should also have an id attribute that matches the labelId prop of the Select.

Consider updating the code as follows:

<FormLabel id={`${component.config?.identifier}-label`} htmlFor={component.config?.identifier}>
  {component.config?.label}
</FormLabel>
<Select
  labelId={`${component.config?.identifier}-label`}
  // ... other props
>
Suggested change
<FormLabel htmlFor={component.config?.identifier}>
{component.config?.label}
</FormLabel>
<Select
<FormLabel
id={`${component.config?.identifier}-label`}
htmlFor={component.config?.identifier}
>
{component.config?.label}
</FormLabel>
<Select
labelId={`${component.config?.identifier}-label`}

Copilot uses AI. Check for mistakes.
displayEmpty
size="small"
id={component.config?.identifier}
name={component.config?.identifier}
required={component.config?.required}
fullWidth
disabled={isLoading}
error={!!errors[component.config?.identifier]}
defaultValue=""
>
<MenuItem value="" disabled>
{component.config?.placeholder || 'Select an option'}
</MenuItem>
Comment on lines +178 to +182
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

The Select component uses defaultValue="" with a disabled placeholder option. However, HTML5 form validation may not work as expected because the disabled empty option can still be submitted as a valid value. For required SELECT fields, this could allow form submission without a valid selection.

Consider using a native <select> element for proper HTML5 validation, or implement custom validation logic to ensure required SELECT fields have a non-empty value before submission.

Copilot uses AI. Check for mistakes.
{component.config.options.map((option: string) => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
{errors[component.config?.identifier] && (
<Typography variant="caption" color="error.main" sx={{mt: 0.5}}>
{errors[component.config?.identifier]}
</Typography>
)}
Comment on lines +189 to +193
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

The error message handling for SELECT inputs is inconsistent with INPUT fields. For INPUT fields (lines 230), errors are displayed using the helperText prop, but for SELECT inputs, errors are displayed using a separate Typography component. This creates an inconsistent user experience.

Consider using the FormHelperText component from MUI or displaying errors consistently across both input types.

Copilot uses AI. Check for mistakes.
{component.config?.hint && (
<Typography variant="caption" color="text.secondary">
{component.config.hint}
</Typography>
)}
</FormControl>
);
}

if (component.type === 'INPUT') {
const isPasswordField: boolean = component.config?.type === 'password';
const showPassword: boolean =
Expand Down
30 changes: 15 additions & 15 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ packages:
- packages/*

catalog:
'@asgardeo/react': 0.6.5
'@asgardeo/react-router': 1.0.5
'@asgardeo/react': 0.6.6
'@asgardeo/react-router': 1.0.6
'@emotion/react': ^11.14.0
'@emotion/styled': ^11.14.1
'@mui/material': ^7.3.4
Expand Down
Loading