Skip to content

Fixed cell styling when in pencil mode#236

Merged
xenobiasoft merged 1 commit into
mainfrom
feature/react-styling-fixes
Apr 25, 2026
Merged

Fixed cell styling when in pencil mode#236
xenobiasoft merged 1 commit into
mainfrom
feature/react-styling-fixes

Conversation

@xenobiasoft
Copy link
Copy Markdown
Owner

Description

When entering possible values in a cell (pencil mode), the cell lost all styling and turned white with no cell border. Added styling to the cell background in pencil mode.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Other (please describe):

Changes Made

  • Added default background color of cell
  • Added override background color of cell for .highlight, .selected, .invalid states
  • Set cell background color as transparent when editing

Testing

  • I have tested these changes locally
  • All existing tests pass
  • I have added new tests (if applicable)

Screenshots (if applicable)

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have updated the documentation (if necessary)

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://gray-bush-02024e71e-236.westus2.7.azurestaticapps.net

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Sudoku cell styling regressions when a cell shows “pencil” (possible) values, ensuring the cell retains its background and state styling instead of appearing unstyled/white.

Changes:

  • Adjusted the cell input’s conditional inline styling when possibleValues are present.
  • Added default <td> background styling for cells, plus state backgrounds for highlight/selected/invalid.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/frontend/Sudoku.React/src/components/CellInput.tsx Updates conditional styling of the input when pencil values are displayed.
src/frontend/Sudoku.React/src/components/CellInput.module.css Adds default and state background colors at the cell (td) level to preserve styling in pencil mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +20
.highlight {
background-color: #d8eef8 !important;
}

.selected {
background-color: #b8d8f0 !important;
}

.invalid {
background-color: #ffdddd !important;
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The new .highlight, .selected, and .invalid rules set background-color with !important, but they already come after .cell in the same CSS module and should win via normal cascade. Dropping !important here will make future overrides easier (and avoids needing even higher-specificity rules later).

Copilot uses AI. Check for mistakes.
Comment on lines 5 to 8
.cell {
background-color: #FAEBD7;
position: relative;
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

#FAEBD7 is now duplicated as the background for both .cell and .cell input, .cell label. To reduce the risk of these drifting out of sync, consider defining a single source (e.g., a CSS variable on .cell and using background-color: inherit for the input/label default state).

Copilot uses AI. Check for mistakes.
onClick={handleClick}
onChange={() => {}}
style={cell.possibleValues.length > 0 && !cell.hasValue ? { opacity: 0 } : undefined}
style={cell.possibleValues.length > 0 && !cell.hasValue ? { backgroundColor: 'transparent' } : undefined}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The inline backgroundColor: 'transparent' here will be overridden in the common “editing” case because the cell is usually also .selected (and .selected input sets background-color: ... !important in the CSS module). If the goal is to keep the input transparent while pencil values are shown/edited, consider toggling a dedicated CSS class (e.g., pencilActive) and applying background-color: transparent !important for pencilActive input, or remove the !important background rules and rely on the <td> background instead.

Copilot uses AI. Check for mistakes.
onClick={handleClick}
onChange={() => {}}
style={cell.possibleValues.length > 0 && !cell.hasValue ? { opacity: 0 } : undefined}
style={cell.possibleValues.length > 0 && !cell.hasValue ? { backgroundColor: 'transparent' } : undefined}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This change introduces new UI behavior (special background handling when pencil values are present) but there’s no test coverage guarding against regression. Consider adding a CellInput test that renders a cell with possibleValues and asserts the input has the expected style/class in that state (and potentially when isSelected is true).

Copilot uses AI. Check for mistakes.
@xenobiasoft xenobiasoft merged commit c25af96 into main Apr 25, 2026
14 checks passed
@xenobiasoft xenobiasoft deleted the feature/react-styling-fixes branch April 25, 2026 14:45
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