目录

@cross-device-app-dev/touch-target-size

Enforce a minimum size requirement on the responseRegion attribute.

The touch target for primary interactive elements or components should be at least 48 vp * 48 vp (recommended), and should not be less than 40 vp * 40 vp.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@cross-device-app-dev/touch-target-size": "warn"
  }
}

Options

This rule is not configurable.

Example of Correct Code

@Entry
@Component
struct Index {
  build() {
    RelativeContainer() {
      Text('message').responseRegion({width: 60, height: 60})
    }
  }
}

Example of Incorrect Code

@Entry
@Component
struct Index {
  build() {
    RelativeContainer() {
      Text('message').responseRegion({width: 27, height: 40})
    }
  }
}

Rule Set

plugin:@cross-device-app-dev/recommended
plugin:@cross-device-app-dev/all

For details about how to configure Code Linter check rules, see Code Linter.