Skip to content

added recursive hoverover feature for stepper#3586

Merged
RichDom2185 merged 7 commits intomasterfrom
feature/recursive-hoverover
Feb 26, 2026
Merged

added recursive hoverover feature for stepper#3586
RichDom2185 merged 7 commits intomasterfrom
feature/recursive-hoverover

Conversation

@wkc75
Copy link
Contributor

@wkc75 wkc75 commented Feb 18, 2026

Created by :
Raaghul Raaghulk04@gmail.com
Kin Chong wongkinchong75@gmail.com

Recursive Popover and CSS Improvements

Summary

This PR introduces recursive popover support and refines multiple CSS styles to improve clarity, consistency, and overall UI readability. Changes include recursive popover rendering, improved marker styling, cleaner hover behaviour, full function-body highlighting, and refined popover box design.


What’s Changed

  • Added recursive popover rendering for recursive functions
  • Fixed inconsistent conditional symbol styling
  • Replaced orange hover backgrounds with bold text for hoverable elements
  • Updated “Before” markers from orange to red
  • Expanded highlighting to cover entire function declaration bodies
  • Refined popover box CSS (spacing, borders, readability)

Before vs After — Visual Changes

Recursive Popover

Before
image

After
Recursive Popover After

Improvement

  • Nested content now renders recursively inside popovers
  • More intuitive expansion of recursive function definitions

Conditional Marker Styling Fix

Before
Symbol Before

After
Symbol After

Improvement

  • Consistent styling for conditional (?) markers
  • Reduced visual inconsistency

Hoverable Elements — Styling Update

Before — Orange Background
Hover Before

After — Bold Text
Hover After

Improvement

  • Hover now uses bold text instead of an orange background
  • Reduces visual noise while maintaining emphasis

“Before” Marker Color Change

Before — Orange Marker
Before Marker Old

After — Red Marker
Before Marker New

Improvement

  • Red marker provides clearer semantic emphasis
  • Avoids confusion with other orange highlights

Function Declaration Highlighting

Before — Partial Highlight
Function Highlight Partial

After — Full Body Highlight
Function Highlight Full

Improvement

  • Entire function declaration body is highlighted
  • Better reflects execution scope compared to partial highlighting

Popover Box CSS Improvements

Before
Popover CSS Before

After
Popover CSS After

Improvement

  • Improved padding and spacing
  • Cleaner borders and contrast
  • Enhanced readability
  • More consistent color coding

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)
  • This change requires a documentation update
  • Code quality improvements

Checklist

  • I have tested this code
  • I have updated the documentation

Co-authored-by: Raaghul <Raaghulk04@gmail.com>
Comment on lines 208 to 214
parentNode?: StepperBaseNode;
isRight?: boolean; // specified for binary expression
styleWrapper: StyleWrapper;
popoverDepth?: number;
}

/**

This comment was marked as outdated.

package.json Outdated
"@sentry/react": "^10.5.0",
"@sourceacademy/c-slang": "^1.0.21",
"@sourceacademy/conductor": "https://github.com/source-academy/conductor.git#0.2.1",
"@sourceacademy/js-slang": "portal:../js-slang",
Copy link
Member

Choose a reason for hiding this comment

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

Revert this change. The package is js-slang, not @sourceacademy/js-slang.

Copy link
Member

Choose a reason for hiding this comment

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

Revert the changes to this file.

Comment on lines 1493 to 1536
// CSS for stepper popover box
.stepper-popover {
.stepper-display {
font: 16px / normal 'Inconsolata', 'Consolas', monospace;
}

.stepper-literal {
color: #ff6078;
}

.stepper-operator {
color: #f89210;
}

.stepper-identifier {
color: #f8d871;
}

.stepper-conditional-operator {
color: #ffffff;
}

.#{$ns}-code-block {
.stepper-literal {
color: #ff6078;
}

.stepper-operator {
color: #f89210;
}

.stepper-identifier {
color: #f8d871;
}

.stepper-conditional-operator {
color: #ffffff;
}

.stepper-mu-term {
font-weight: bold;
cursor: pointer;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Please use CSS modules instead of global styles

) {
function addHovering(preprocessed: React.ReactNode): React.ReactNode {
const functionDefinition = astToString(node);
// const functionDefinition = astToString(node);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this commented out?

Comment on lines 324 to 346

/**
* Recursive Hoverover feature
* muTermStyleWrapper wraps identifiers in the code body with popover
*/
const FunctionDefinitionPopoverContent = () => (
<div className={classNames('stepper-popover', Classes.DARK)}>
<div className="stepper-display">
<Icon icon="code" />
<span>{' Function definition'}</span>
<pre className={Classes.CODE_BLOCK}>
<code>
{renderFunctionArguments(node.params)}
<span className="stepper-identifier">{' => '}</span>
{renderNode(node.body, {
styleWrapper: composeStyleWrapper(styleWrapper, muTermStyleWrapper)!,
popoverDepth: popoverDepth + 1
})}
</code>
</pre>
</div>
</div>
);
Copy link
Member

Choose a reason for hiding this comment

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

Don't nest components as this results in highly inefficient code.

Comment on lines 39 to 46
import { astToString } from 'js-slang/dist/utils/ast/astToString';
// import { astToString } from 'js-slang/dist/utils/ast/astToString';
import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';

import { beginAlertSideContent } from '../SideContentActions';
import { SideContentLocation, SideContentType } from '../SideContentTypes';
// import { cons } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base';
Copy link
Member

Choose a reason for hiding this comment

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

Please remove commented code if unused.

@Raaghulk04 Raaghulk04 force-pushed the feature/recursive-hoverover branch from 017d8d6 to 639ca6d Compare February 21, 2026 07:16
Comment on lines 330 to 335
function addHovering(preprocessed: React.ReactNode): React.ReactNode {
const functionDefinition = astToString(node);
return (
<span className="stepper-mu-term">
<Popover
interactionKind="hover"

This comment was marked as outdated.

@coveralls
Copy link

coveralls commented Feb 21, 2026

Pull Request Test Coverage Report for Build 22253403945

Details

  • 1 of 12 (8.33%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.06%) to 40.654%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/sideContent/content/SideContentSubstVisualizer.tsx 1 12 8.33%
Files with Coverage Reduction New Missed Lines %
src/commons/sideContent/content/SideContentSubstVisualizer.tsx 1 14.46%
src/commons/sideContent/content/SideContentCseMachine.tsx 3 37.8%
Totals Coverage Status
Change from base Build 22213982646: -0.06%
Covered Lines: 5261
Relevant Lines: 11985

💛 - Coveralls

@Raaghulk04 Raaghulk04 force-pushed the feature/recursive-hoverover branch from 319bc58 to 639ca6d Compare February 21, 2026 07:41
Comment on lines 523 to 530
return (
<span>
<span className="stepper-operator">{'return '}</span>
{node.argument && renderNode(node.argument, { styleWrapper: styleWrapper })}
{node.argument &&
renderNode(node.argument, { styleWrapper: styleWrapper, popoverDepth: popoverDepth })}
{';'}
</span>
);

This comment was marked as outdated.

@Raaghulk04 Raaghulk04 force-pushed the feature/recursive-hoverover branch from 1a9242d to 5362c9e Compare February 21, 2026 08:11
@RichDom2185 RichDom2185 enabled auto-merge (squash) February 26, 2026 12:28
@RichDom2185 RichDom2185 merged commit d6d5539 into master Feb 26, 2026
9 of 10 checks passed
@RichDom2185 RichDom2185 deleted the feature/recursive-hoverover branch February 26, 2026 12:30
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.

5 participants