WebViewer Version: 11.7.1
Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? Yes
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? No
Please give a brief summary of your issue:
Want to make custom button behavior same as built-in button
Please describe your issue and provide steps to reproduce it:
I have added new custom button, on selecting that button is not behaving the same as built-in button.
const waterMarkButton = new instance.UI.Components.CustomButton({
dataElement: 'WaterMarkButton',
title: 'WaterMark',
img: `<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<path d="M96 32h240l80 80v368H96z" fill="#f7f3f2"/>
<path d="M336 32v80h80z" fill="#e0ddef"/>
<path d="M256 170 L190 360 H220 L238 310 H274 L292 360 H322 L256 170 Z M246 285 L256 250 L266 285 Z" fill="#000"/>
<rect x="140" y="140" width="90" height="14" rx="7" fill="#000"/>
<rect x="140" y="190" width="75" height="14" rx="7" fill="#000"/>
<rect x="140" y="240" width="70" height="14" rx="7" fill="#000"/>
<rect x="140" y="290" width="60" height="14" rx="7" fill="#000"/>
<rect x="290" y="140" width="90" height="14" rx="7" fill="#000"/>
<rect x="300" y="190" width="75" height="14" rx="7" fill="#000"/>
<rect x="304" y="240" width="70" height="14" rx="7" fill="#000"/>
<rect x="310" y="290" width="60" height="14" rx="7" fill="#000"/>
<rect x="140" y="390" width="240" height="16" rx="8" fill="#000"/>
</svg>`,
onClick: () => {
instance.UI.openElements(['waterMarkPanel']);
instance.UI.setActiveLeftPanel('waterMarkPanel');
}
});
let insertGroupedItems = toolHeader
.getItems('groupedItems')
.find((data) => data.dataElement === 'insertGroupedItems');
let annotateToolGrpItem = insertGroupedItems.items.find(
(data) => data.dataElement === 'insertToolsGroupedItems'
);
annotateToolGrpItem.items.splice(4, 0, waterMarkButton);
toolHeader.setItems([...toolHeader.getItems()]);```
In Apryse WebViewer, toolbar buttons (such as **Note**, **Highlight**, **Strikeout**, etc.) automatically show a **selected/active state** when clicked.
This is because Apryse internally manages the UI state for all *built-in annotation tools*.
However, the **custom watermark button** (or any other custom button you added) does **NOT** show the selected/active styling.
When the user clicks on it:
* The button does not highlight
* No active border or background appears
* The button does not behave like other built-in annotation buttons
This creates inconsistent UX because all native annotation buttons visually indicate selection, but the custom button does not.
When user click on the custom watermark button, there is not active effect.

But when user click on the stamp button there is active effect visible.

Please provide a link to a minimal sample where the issue is reproducible:


