This commit is contained in:
Josh at WLTechBlog
2025-11-20 14:47:55 -07:00
parent 88d8202b0d
commit f8fbfddc7f
5 changed files with 769 additions and 12 deletions

View File

@@ -4136,8 +4136,9 @@ type KeyboardTestIssue struct {
// TestKeyboardNavigation tests keyboard navigation and accessibility
// If tabID is empty, the current tab will be used
// useRealKeys determines whether to use real Tab key simulation (true) or programmatic focus (false)
// timeout is in seconds, 0 means no timeout
func (c *Client) TestKeyboardNavigation(tabID string, timeout int) (*KeyboardTestResult, error) {
func (c *Client) TestKeyboardNavigation(tabID string, useRealKeys bool, timeout int) (*KeyboardTestResult, error) {
params := map[string]string{}
// Only include tab ID if it's provided
@@ -4145,6 +4146,11 @@ func (c *Client) TestKeyboardNavigation(tabID string, timeout int) (*KeyboardTes
params["tab"] = tabID
}
// Add use_real_keys parameter
if useRealKeys {
params["use_real_keys"] = "true"
}
// Add timeout if specified
if timeout > 0 {
params["timeout"] = strconv.Itoa(timeout)
@@ -4474,8 +4480,9 @@ type KeyboardAuditResult struct {
// checkFocusIndicators determines whether to check for visible focus indicators
// checkTabOrder determines whether to check tab order
// checkKeyboardTraps determines whether to check for keyboard traps
// useRealKeys determines whether to use real Tab key simulation (true, default) or programmatic focus (false)
// timeout is in seconds, 0 means no timeout
func (c *Client) GetKeyboardAudit(tabID string, checkFocusIndicators, checkTabOrder, checkKeyboardTraps bool, timeout int) (*KeyboardAuditResult, error) {
func (c *Client) GetKeyboardAudit(tabID string, checkFocusIndicators, checkTabOrder, checkKeyboardTraps, useRealKeys bool, timeout int) (*KeyboardAuditResult, error) {
params := map[string]string{}
// Only include tab ID if it's provided
@@ -4494,6 +4501,11 @@ func (c *Client) GetKeyboardAudit(tabID string, checkFocusIndicators, checkTabOr
params["check_keyboard_traps"] = "true"
}
// Add use_real_keys parameter (default to true for better accuracy)
if !useRealKeys {
params["use_real_keys"] = "false"
}
// Add timeout if specified
if timeout > 0 {
params["timeout"] = strconv.Itoa(timeout)