Skip to content

Fix the drag and drop "Add Bucket" button.#1429

Merged
Alex-Jordan merged 1 commit into
openwebwork:PG-2.21from
drgrice1:bugfix/drag-n-drop-add-bucket
Jun 7, 2026
Merged

Fix the drag and drop "Add Bucket" button.#1429
Alex-Jordan merged 1 commit into
openwebwork:PG-2.21from
drgrice1:bugfix/drag-n-drop-add-bucket

Conversation

@drgrice1
Copy link
Copy Markdown
Member

@drgrice1 drgrice1 commented Jun 6, 2026

I accidentally removed the default value for the indices argument to the htmlBucket function in #1394. That breaks the "Add Bucket" button because when it constructs a new Bucket there are no indices. This happened because I converted this JavaScript into TypeScript in a webpack built project for testing, and in the conversion back to JavaScript I deleted the typing that was added to the parameter, but was to aggressive in the deletion, and also deleted the default value.

For a basic problem to test with you can use:

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'MathObjects.pl', 'draggableSubsets.pl');

$draggable = DraggableSubsets(
    [
        '\(e\)',  '\(r\)', '\(r^2\)', '\(s\)',
        '\(sr\)', '\(sr^2\)'
    ],
    [ [ 0, 3 ], [ 1, 4 ], [ 2, 5 ] ],
    DefaultSubsets => [
        {
            label     => 'Coset 1',
            indices   => [ 0 .. 3 ],
            removable => 0
        },
        {
            label     => 'Coset 2',
            indices   => [4],
            removable => 1
        },
        {
            label     => 'Coset 3',
            indices   => [5],
            removable => 1
        }
    ],
    BucketLabelFormat => 'Coset %s',
    AddButtonText     => 'Add Coset',
    RemoveButtonText  => 'Remove Coset',
);

BEGIN_PGML
Let [``G = D_3 = \{ e,r,r^2, s,sr,sr^2 \}``] be the Dihedral group of order
[`6`], where [`r`] is the counter-clockwise rotation by [`2\pi/3`], and [`s`] is
the reflection across the [`x`]-axis.

Partition [`G = D_3`] into *right* cosets of the subgroup [`H = \{ e, s \}`].
Give your result by dragging the following elements into separate buckets, each
corresponding to a coset.

[_]{$draggable}
END_PGML

ENDDOCUMENT();

I accidentally removed the default value for the `indices` argument to
the `htmlBucket` function in openwebwork#1394. That breaks the "Add Bucket" button
because when it constructs a new `Bucket` there are no `indices`. This
happened because I converted this JavaScript into TypeScript in a
webpack built project for testing, and in the conversion back to
JavaScript I deleted the typing that was added to the parameter, but was
to aggressive in the deletion, and also deleted the default value.

For a basic problem to test with you can use:

```Perl
DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'MathObjects.pl', 'draggableSubsets.pl');

$draggable = DraggableSubsets(
    [
        '\(e\)',  '\(r\)', '\(r^2\)', '\(s\)',
        '\(sr\)', '\(sr^2\)'
    ],
    [ [ 0, 3 ], [ 1, 4 ], [ 2, 5 ] ],
    DefaultSubsets => [
        {
            label     => 'Coset 1',
            indices   => [ 0 .. 3 ],
            removable => 0
        },
        {
            label     => 'Coset 2',
            indices   => [4],
            removable => 1
        },
        {
            label     => 'Coset 3',
            indices   => [5],
            removable => 1
        }
    ],
    BucketLabelFormat => 'Coset %s',
    AddButtonText     => 'Add Coset',
    RemoveButtonText  => 'Remove Coset',
);

BEGIN_PGML
Let [``G = D_3 = \{ e,r,r^2, s,sr,sr^2 \}``] be the Dihedral group of order
[`6`], where [`r`] is the counter-clockwise rotation by [`2\pi/3`], and [`s`] is
the reflection across the [`x`]-axis.

Partition [`G = D_3`] into *right* cosets of the subgroup [`H = \{ e, s \}`].
Give your result by dragging the following elements into separate buckets, each
corresponding to a coset.

[_]{$draggable}
END_PGML

ENDDOCUMENT();
```
Copy link
Copy Markdown
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

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

Fixes the issue.

Copy link
Copy Markdown
Contributor

@Alex-Jordan Alex-Jordan left a comment

Choose a reason for hiding this comment

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

Fixed for me too.

@Alex-Jordan Alex-Jordan merged commit 0a235ec into openwebwork:PG-2.21 Jun 7, 2026
3 checks passed
@drgrice1 drgrice1 deleted the bugfix/drag-n-drop-add-bucket branch June 7, 2026 20:03
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.

3 participants