Skip to content

Conversation

@styrix560
Copy link
Collaborator

fixes #2302

@styrix560 styrix560 marked this pull request as ready for review June 30, 2025 18:23
@niklasmohrin niklasmohrin marked this pull request as draft June 30, 2025 18:58
@styrix560 styrix560 force-pushed the 2302-no-feedback-button-does-not-clear-textanswers branch from d60e52a to 37005d0 Compare June 30, 2025 19:18
@styrix560 styrix560 marked this pull request as ready for review June 30, 2025 19:33
@styrix560 styrix560 changed the title Add animation on evaluation deletion Feedback button clears text answers Jun 30, 2025
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

Haven't tested yet; code structure looks good, some comments on implementation

@styrix560 styrix560 requested a review from niklasmohrin July 7, 2025 15:19
Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

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

Nice! Please collapse all textboxes from the additional textanswers that have been cleared. When a user opens a collapsed contributor again, these textboxes should be collapsed, as they were initially.

@richardebeling richardebeling changed the title Feedback button clears text answers "I can't give feedback" button clears text answers Jul 13, 2025
richardebeling
richardebeling previously approved these changes Jul 13, 2025
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

code looks generally good to me

@niklasmohrin can you take a look at the modal logic? I think it matches what we did for the reset evaluation button.

@styrix560 styrix560 requested a review from niklasmohrin July 21, 2025 16:18
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

Nice work, there seem to be a handful of moving parts, but complexity is still manageable in my opinion.

Please make sure to actively review the code in the Files Changed tab of github to ensure everything is clean before requesting reviews, right now there is for example console.log, unrelated formatting, or unnecessarily moved lines like at the // Disable this button, until user changes a value line. Otherwise we reviewers might overlook the important bits and the PR could take longer to merge overall.

I think this PR is looking very promising! I hope we can manage to capture the changes in tests so that we reduce the risk that someone messes this up on accident at a later time - it's super hard to always remember all the small UI flows when reviewing, so having tests as a safety net is a great help.

Comment on lines 361 to 367
const radioButtons = voteArea.querySelectorAll(".vote-inputs [type=radio]:not([value='6'])");
for (const radioButton of radioButtons) {
if (radioButton.checked) {
return true;
}
}
return false;
Copy link
Member

Choose a reason for hiding this comment

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

I think we can do something like this:

Suggested change
const radioButtons = voteArea.querySelectorAll(".vote-inputs [type=radio]:not([value='6'])");
for (const radioButton of radioButtons) {
if (radioButton.checked) {
return true;
}
}
return false;
return voteArea.querySelector(".vote-inputs [type=radio]:not([value='6']):checked") !== null;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we cannot, because the checked in my code is not a css property, but instead exists on the javascript object

Copy link
Member

Choose a reason for hiding this comment

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

@styrix560 styrix560 requested a review from niklasmohrin August 4, 2025 20:20
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

not changed since last time

@richardebeling richardebeling marked this pull request as draft September 1, 2025 20:03
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

merge conflicts

@styrix560 styrix560 marked this pull request as ready for review December 15, 2025 17:08
Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

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

Hovering over the disabled "make active" button on a staff semester page unexpectedly opens the modal 😅

@niklasmohrin
Copy link
Member

Can you briefly explain what caused the modal showing up on hover?

@styrix560 styrix560 requested a review from janno42 December 16, 2025 11:40
@styrix560
Copy link
Collaborator Author

Can you briefly explain what caused the modal showing up on hover?

Bootstrap added an onmouseover-listener to the confirmation modal in the semester view. This is supposed to show the tooltip. However, when implementing show on the confirmation-modal, we somehow overrode some method, the bootstrap listener called, which means, that every onmouseover event calls our show method, which shows the modal. Renaming it to showModal fixes the issue.

@niklasmohrin
Copy link
Member

I see, how annoying

@niklasmohrin
Copy link
Member

I suppose bootstrap's idea of these attributes is that they take full ownership over this element, so a <span data-bs-...><confirmation-modal ...> is probably the safer thing to do in such cases. Let's keep that in mind for the future. For this PR, just leave it as is (with the renamed method)

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

I didn't thoroughly check the implementation now, except that I saw some console log and an empty line being added. I will come back to that later. In the meantime, please perform a quick self-review to sort out these small things.

For the tests, I have some questions.

(I also unresolved a previous discussion, please take a look)

Comment on lines +132 to +133
cancel_button[0].click()
time.sleep(1)
Copy link
Member

Choose a reason for hiding this comment

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

Are the sleep calls really needed? I thought that selenium waits until all events triggered by the click are over?

Either way, in this case here we can also press Esc instead of clicking on the button. Then the modal will close instantly, and this is standard browser behavior, so selenium should definitely know what is happening

Comment on lines +128 to +130
modal = self.selenium.find_elements(By.CSS_SELECTOR, "confirmation-modal.mark-no-answer-modal")
self.assertEqual(len(modal), 2)
cancel_button = modal[0].shadow_root.find_elements(By.CSS_SELECTOR, "section.button-area > button")
Copy link
Member

Choose a reason for hiding this comment

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

why the [0]? I think what we really want to do is something along the lines of confirmation-modal.mark-no-answer-modal:has(dialog:open)

Comment on lines +143 to +144
# Waiting for element_to_be_clickable does not work unfortunately
time.sleep(1)
Copy link
Member

Choose a reason for hiding this comment

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

but does something not work then? the only thing we need is that the event handlers from the start are set, right? so why do we need to wait again here?

Comment on lines +174 to +176
textarea.send_keys("b")
button.click()
assert_modal_visible_and_close()
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand, we replace 'a' with 'b' and click again and then the modal shows again; what is the test? Isn't the interesting bit that it does not show if we edit textareas somewhere else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

'can't give feedback' button does not clear textanswers

4 participants