Cannot set the td.title of a frozen column

Here is an interesting one…

I’ve been using a custom plugin to set the title of a cell when it has an error. It works for everything, except for frozen columns:

export class ErrorTitlePlugin extends BasePlugin {

  public static get PLUGIN_KEY() {
    return 'errortitle';
  }

  public enablePlugin() {
    this.addHook(
      "afterValidate",
      (isValid: boolean, value: CellValue, row: number, prop: number | string, source: ChangeSource) =>
        this.onAfterValidate(isValid, value, row, prop, source)
    );
    super.enablePlugin();
  }

  public isEnabled() {
    const settings = this.hot.getSettings() as TGridSettings;
    return settings['errortitle'];
  }

  // this is called externally, eg in a validator function
  public setErrorTitle(cell: CellProperties, errors: string) {
    this.hot.setCellMeta(cell.visualRow, cell.visualCol, 'errortitlekey', title);
  }

  // this works for everything except frozen columns
   private onAfterValidate(
    isValid: boolean,
    _value: CellValue,
    row: number,
    prop: number | string,
    _source: ChangeSource
  ) {
    const col = this.hot.propToCol(prop) as number;
    const cell = this.hot.getCell(row, col);
    if (cell) {
      if (isValid) {
        cell.removeAttribute("title");
      } else {
        const meta = this.hot.getCellMeta(row, col);
        cell.title = meta['errortitlekey'] ?? "";
      }
    }
  }
}

Anyway, when I log out cell above in onAfterValidate I do see an HTML TD element with the title set, yet something after-the-fact is removing this… it must be when it renders the column because it is frozen, it for some reason removes the title. I guess “afterValidate” is probably called before whatever freezes columns… I wonder if there is another hook I can use to maintain this, or if we can fix the renderer of frozen columns to preserve custom HTML attributes…

Hi @anthony.agostino

Can you please share a minified code demo where the issue can be replicated? With custom implementations it will hard to propose any solution without the example.

Sure please see attached

https://codesandbox.io/p/devbox/react-handsontable-forked-v9zhj6?workspaceId=ws_FBUmtLZMPJxRa4ZC91xHCh

  1. Hover over the first cell at 0, 0
  2. You should see an html title render with some text after a second
  3. Now freeze the column
  4. The title is gone

I have a hunch there is another hook I will need to attach to like “afterColumnFreeze” but that doesn’t exist. Ideally it would just not remove custom html attributes to the td.