Hi @David Delcò AMUT
From a developer's point of view, it is possible to use SPFX to create a new Web part, and then modify the properties of elements through click events.
pointer-events: none;
In spfx, the operation on the element is realized by calling the element class name.
Here is code:
Button CSS:
.styled {
border: 0;
line-height: 2.5;
padding: 0 20px;
font-size: 1rem;
text-align: center;
color: #fff;
text-shadow: 1px 1px 1px #000;
border-radius: 10px;
background-color: rgba(220, 0, 0, 1);
background-image: linear-gradient(to top left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 30%, rgba(0, 0, 0, 0));
box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.6), inset -2px -2px 3px rgba(0, 0, 0, 0.6);
}
.styled:hover {
background-color: rgba(255, 0, 0, 1);
}
.styled:active {
box-shadow: inset -2px -2px 3px rgba(255, 255, 255, 0.6), inset 2px 2px 3px rgba(0, 0, 0, 0.6);
}
Here is code:
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import styles from './HelloWorldWebPart.module.scss';
export interface IHelloWorldWebPartProps {
description: string;
}
export default class HelloWorldWebPart extends BaseClientSideWebPart<IHelloWorldWebPartProps> {
public render(): void {
this.domElement.innerHTML = `
<button id="rArrow" class="${styles.styled}"
type="button " onClick="swap()">
Add to favorites
</button>
</section>`;
let clickEvent= document.getElementById('rArrow');
clickEvent.addEventListener("click", (e: Event) => this.swap());
}
swap() {
const element = document.querySelector(".a_ai_ada2ac09 ") as HTMLElement;
if (element) {
element.setAttribute("style", "pointer-events: none;"); // set style "pointer-events: none;"
}
}
}
Here is result:
How to create SPFX Web part and upload it to sharepoint, please refer to the link below:
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards
Cheng Feng