Skip to content

Test mouse interaction with elements outside the viewport - #117

Open
aik099 wants to merge 1 commit into
minkphp:masterfrom
aik099:test/outside-viewport
Open

aik099 wants to merge 1 commit into
minkphp:masterfrom
aik099:test/outside-viewport

Conversation

@aik099

@aik099 aik099 commented Oct 11, 2026

Copy link
Copy Markdown
Member

Adds tests for click, double-click, right-click and mouse over on elements that are below the viewport. Each test scrolls to the top of the page first, so the element is outside the viewport when the driver method is called.

W3C drivers scroll the element into view for clicks themselves, but drivers that move the mouse to the element first may not. For example, MinkSelenium2Driver on Selenium 3 + Firefox fails with:

MoveTargetOutOfBounds: Move target (640, 1934) is out of bounds of viewport dimensions (1280, 860)

That's fixed in minkphp/MinkSelenium2Driver#389, which waited for a test like this.

Tested locally (macOS, Selenium jars, Brave 155 and Firefox 157):

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
});

document.getElementById('right-click-target').addEventListener('contextmenu', function (event) {
event.preventDefault();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we should add preventDefault()/stopPropagation() everywhere.
Some browsers, like MS Edge show a menu context menu when text is selected via double click, for instance.

@aik099 aik099 Oct 19, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@uuf6429, this deserves a separate task/pr with research attached. Test suite doesn't really fail without them, but to avoid any future failing tests due to unexpected event propagation, this could be handy.

</div>

<script type="text/javascript">
document.getElementById('click-target').addEventListener('click', function () {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just thinking out loud, could it make sense to use pointer events (which also capture touch etc) instead? Or do we maybe specifically want these mouse events?

I guess it's more of a question on the mink side - that touch events should be a different API?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@uuf6429, we'd better create an issue in Mink repo itself for discussing such API.

Some ideas:

  • understand underlying driver support for pointer events?
  • how are js events triggered (does mouse* event trigger matching pointer* event and vice versa)?
  • how do mouse/pointer events behave on desktop/mobile devices?
  • what about community-built Mink drivers (Chrome, Playwright, etc.)?

What I try to avoid here is by making the current mouse-api acting as point event API causing a break for desktop users. If we do introduce parallel pointer-api, then could drivers actually handle it without Syn-based magic.

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