A-3160 Try to give regions an HTML DOM ID.
Reason
Without an explicit HTML DOM ID, APEX generates the DOM id of the region from the internal region id (R1234567890). JavaScript (apex.region("…")), CSS and dynamic actions with a jQuery selector that address the region then depend on a number that changes when the page is copied or the app is imported into another workspace. (Dynamic actions with selection type Region are not affected.)
Set the region's HTML DOM ID to its Static ID: every region has one since APEX 26.1, and it is already unique on the page, so there is no new name to invent. Regions that are never addressed from JavaScript or CSS can do without one.
Example
Non-Compliant Example
page 10 (
// ...
region orders (
name: Orders
type: staticContent
// ...
// no htmlDomId
)
) | Line | Column | Message |
|---|---|---|
| 3 | 12 |
Compliant Solution - ★★★★★
page 10 (
// ...
region orders (
name: Orders
type: staticContent
// ...
advanced {
htmlDomId: orders
}
)
) Tests
Test SQL query
select aa.workspace || '.' || aa.alias || '.' || r.page_id || '.' || r.region_static_id as identifier,
'Region ' || r.region_name || ' on page ' || r.page_id || ' of app ' || aa.alias || ' in ' || aa.workspace
|| ' has no HTML DOM ID.' as message
from apex_application_page_regions r
join apex_applications aa
on aa.application_id = r.application_id
and aa.workspace = r.workspace
where aa.workspace in (#ApexWorkspaces#)
and r.html_dom_id is nullTest results
| Identifier | Message | Migration |
|---|---|---|
| WORKSPACE.CUSTOMERS.10.orders | Region Orders on page 10 of app CUSTOMERS in WORKSPACE has no HTML DOM ID. | - |
Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| ApexWorkspaces | Comma-separated List of APEX workspaces owning APEX applications to check. | dblinter, dbl_gui |
References
- same as UC-3160