List Formatting: When an `a` element is set as a child of a `div` element with `setValue` configured, `setValue` stops working
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
Declarative list formatting
Developer environment
Windows
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [X] 💥 Microsoft Edge
- [X] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
No response
Describe the bug / error
In order to investigate the count of link clicks, the a element was placed in the child element of the div element with setValue. Previously, the setValue worked and counted up, but it no longer works.
Is this a bug? Or is it a specification?
Steps to reproduce
- Create a list
- Create a hyperlink column with any column name
- Create a number column with internal name
ClickCount - Apply the following JSON to the hyperlink column created in 2.
Column Formatting JSON
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "=if(@currentField == '' , 'none' , '')"
},
"children": [
{
"elmType": "div",
"customRowAction": {
"action": "setValue",
"actionInput": {
"ClickCount": "= [$ClickCount] + 1"
}
},
"children": [
{
"elmType": "a",
"style": {
"text-decoration": "none",
"padding": "5px 10px 5px 10px",
"font-weight": "bold",
"border-radius": "5px",
"font-size": "13px",
"white-space": "nowrap"
},
"txtContent": "@currentField.desc",
"attributes": {
"href": "@currentField",
"target": "_blank",
"class": "ms-fontColor-themePrimary ms-bgColor-themeLighter ms-fontColor-white--hover ms-bgColor-themePrimary--hover"
}
}
]
}
]
}
Expected behavior
When I click on the link, the link opens and setValue works as before.
(The above video was retrieved from hyperlink-click-count.)
When I set the same JSON as now in the document library, setValue worked and ClickCount counted up.
@tecchan1107 Thanks for reporting the issue. It is fixed and should be in prod in 2-3 weeks.
@tpodugu-ms @VesaJuvonen Hello! I am also experiencing this issue in my environment and I am seeking a resolution. You mentioned that the fix would take 2-3 weeks, so I would like to check the current status of the progress.
@VesaJuvonen @myNCA-2024 Fix will reach to prod 100% in 1-2 days.
I checked today and this issue has been fixed!
@tpodugu-ms Thank you for your help and fixing this issue!